Hello,
I’m developping a plugin for wordpress. The plugin needs to create posts and because I need a PostID at the beginning, I use the function “get_default_post_to_edit”.
When I call wp_update_post($post_data) for updating my post, some default wordpress “Actions” are not executed (add_action(“save_post”:wink:).
Wich wordpress function do I need to call for correctly publishing my new post ?
Here is a sample of my code :
//Get Default Post to Edit
$post_data = get_default_post_to_edit($MyOptions["default_post_type"], true );
//Here I modify some field of $post_data and I set the post_status
//....
$post_data->post_status = $MyOptions["default_post_status"]; //"Published"
//...
//Then, I update my post (and publish it)
wp_update_post($post_data);
In my case, I’ve got another plugin using add_action(‘save_post’, …:wink:. But that code is not executed when I call wp_update_post from my plugin’s code.
Thanks,
Didier