Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: private_to_published

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
3267  * @param object $post Object type containing the post information
3268  */
3269 function _transition_post_status($new_status, $old_status, $post) {
3270      global $wpdb;
3271
3272      if ( $old_status != 'publish' && $new_status == 'publish' ) {
3273           // Reset GUID if transitioning to publish and it is empty
3274           if ( '' == get_the_guid($post->ID) )
3275                $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
3276           do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
3277           // do generic pings once per hour at most
3278           if ( !wp_next_scheduled('do_generic_ping') )
3279                wp_schedule_single_event(time() + 3600, 'do_generic_ping');
3280      }
3281
3282      // Always clears the hook in case the post status bounced from future to draft.
3283      wp_clear_scheduled_hook('publish_future_post', $post->ID);
3284 }
3285