Welcome, visitor! Log in
 

Source View: publish_post

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
656       // Set GUID
657       if ( ! $update )
658            $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
659  
660       if ( $update) {
661            if ($previous_status != 'publish' && $post_status == 'publish') {
662                 // Reset GUID if transitioning to publish.
663                 $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
664                 do_action('private_to_published', $post_ID);
665            }
666  
667            do_action('edit_post', $post_ID);
668       }
669  
670       if ($post_status == 'publish' && $post_type == 'post') {
671            do_action('publish_post', $post_ID);
672            if ( defined('XMLRPC_REQUEST') )
673                 do_action('xmlrpc_publish_post', $post_ID);
674            if ( defined('APP_REQUEST') )
675                 do_action('app_publish_post', $post_ID);
676  
677            if ( !defined('WP_IMPORTING') ) {
678                 if ( $post_pingback )
679                      $result = $wpdb->query("
680                           INSERT INTO $wpdb->postmeta
681                           (post_id,meta_key,meta_value)
682                           VALUES ('$post_ID','_pingme','1')
683                      ");
684                 $result = $wpdb->query("
685                      INSERT INTO $wpdb->postmeta
686                      (post_id,meta_key,meta_value)