I’m trying to update a target page (not the page the shortcode is on) by calling a shortcode on a specific page. Imagine having two links on your phone for saying “The Ski Slope is Open” or “The Ski Slope is Closed” on a specific page and being able to toggle that by triggering a specific shortcode. Could this be achieved by inserting something like this into the shortcode function:
​
$postId=1011;
$mynewpagedata = array(
‘ID’ => $postId,
‘post\_contnet’ => ‘The Ski Slope is Open’,
);
wp\_update\_post ($mynewpagedata);
​
Any help would be greatly appreciated.
[ad_2]
Sure
You spelled content wrong.. Was that the same in your environment?
So from what I can tell, your trying to make a sign on a page say open or closed, and instead of signing in and doing it manually your trying to visit a second page to activate the switch right?
wp_update_post( $mynewpostdata, true ); if (is_wp_error($post_id)) { $errors = $post_id->get_error_messages(); foreach ($errors as $error) { echo $error; } }
See if this echos an error on the page?
What’s your shortcode look like.