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
4776  * @param object $post Object type containing the post information
4777  */
4778 function _transition_post_status($new_status, $old_status, $post) {
4779      global $wpdb;
4780
4781      if ( $old_status != 'publish' && $new_status == 'publish' ) {
4782           // Reset GUID if transitioning to publish and it is empty
4783           if ( '' == get_the_guid($post->ID) )
4784                $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
4785           do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
4786      }
4787
4788      // If published posts changed clear the lastpostmodified cache
4789      if ( 'publish' == $new_status || 'publish' == $old_status) {
4790           foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
4791                wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' );
4792                wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' );
4793           }
4794      }