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
1519           }
1520           update_post_meta($post_ID, '_wp_page_template',  $page_template);
1521      }
1522
1523      wp_transition_post_status($post_status, $previous_status, $post);
1524
1525      if ( $update)
1526           do_action('edit_post', $post_ID, $post);
1527
1528      do_action('save_post', $post_ID, $post);
1529      do_action('wp_insert_post', $post_ID, $post);
1530
1531      return $post_ID;
1532 }
1533
1534 /**
1535  * Update a post with new post data.
1536  *
1537  * The date does not have to be set for drafts. You can set the date and it will
 
Line Code
1608      wp_transition_post_status('publish', $old_status, $post);
1609
1610      // Update counts for the post's terms.
1611      foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
1612           $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
1613           wp_update_term_count($tt_ids, $taxonomy);
1614      }
1615
1616      do_action('edit_post', $post_id, $post);
1617      do_action('save_post', $post_id, $post);
1618      do_action('wp_insert_post', $post_id, $post);
1619 }
1620
1621 /**
1622  * Publish future post and make sure post ID has future post status.
1623  *
1624  * Invoked by cron 'publish_future_post' event. This safeguard prevents cron
1625  * from publishing drafts, etc.
1626  *