The changes all involve post status transitions.
Pretty major updates through here. Tried to make it clear that there are three kinds of post status transition action hooks. They are all called by the function wp_transition_post_status()
in wp-includes/post.php.
Plugin API/Action Reference/publish post
So, in fact, this action hook was not depreciated. I added an explanation why and an example of correct usage.
Plugin API/Action Reference/publish page
As above except with no example.
I updated the existing entries and added the missing action hooks.
transition_post_status
– Added.(old status)_to_(new status)
– Updated.(status)_(post_type)
– Added.publish_post
– Updated (not depreciated).publish_page
– Updated (not depreciated).add_action('publish_page', 'add_custom_field_automatically');
add_action('publish_post', 'add_custom_field_automatically');
function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, 'status', 'notanswered', true);
}
}
It only works if I deactivated Meta Box plugin
I wonder why? Thanks in advance.
]]>first post here – hope it’s in the correct forum.
I am writing plug-in that is triggered on the ‘publish_page’ hook.
The plug-in will export certain parts of the page to an xml file.
What I’d like to know is when the publish_page hook fires?
Would my plug-in fire before the wp_n_posts table has been updated or after?
I’m using an WPMU install.
TIA
]]>