Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: save_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.

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

Source View

This hook occurs 2 times in this file.

Line Code
760      $post = get_post($post_ID);
761      if ( !empty($page_template) )
762           $post->page_template = $page_template;
763
764      wp_transition_post_status($post_status, $previous_status, $post);
765
766      if ( $update)
767           do_action('edit_post', $post_ID, $post);
768
769      do_action('save_post', $post_ID, $post);
770      do_action('wp_insert_post', $post_ID, $post);
771
772      return $post_ID;
773 }
774
775 function wp_update_post($postarr = array()) {
776      global $wpdb;
777
778      if ( is_object($postarr) )
 
Line Code
824           return;
825
826      $wpdb->query( "UPDATE $wpdb->posts SET post_status = 'publish' WHERE ID = '$post_id'" );
827
828      $old_status = $post->post_status;
829      $post->post_status = 'publish';
830      wp_transition_post_status('publish', $old_status, $post);
831
832      do_action('edit_post', $post_id, $post);
833      do_action('save_post', $post_id, $post);
834      do_action('wp_insert_post', $post_id, $post);
835 }
836
837 function wp_add_post_tags($post_id = 0, $tags = '') {
838      return wp_set_post_tags($post_id, $tags, true);
839 }
840
841 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
842      /* $append - true = don't delete existing tags, just add on, false = replace the tags with the new tags */