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
1826 // Hooks
1827 //
1828
1829 function _transition_post_status($new_status, $old_status, $post) {
1830      global $wpdb;
1831
1832      if ( $old_status != 'publish' && $new_status == 'publish' ) {
1833                // Reset GUID if transitioning to publish.
1834                $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post->ID) . "' WHERE ID = '$post->ID'");
1835                do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
1836      }
1837
1838      // Always clears the hook in case the post status bounced from future to draft.
1839      wp_clear_scheduled_hook('publish_future_post', $post->ID);
1840 }
1841
1842 function _future_post_hook($post_id, $post) {
1843      // Schedule publication.
1844      wp_clear_scheduled_hook( 'publish_future_post', $post->ID );