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
1802           }
1803           update_post_meta($post_ID, '_wp_page_template',  $page_template);
1804      }
1805
1806      wp_transition_post_status($data['post_status'], $previous_status, $post);
1807
1808      if ( $update)
1809           do_action('edit_post', $post_ID, $post);
1810
1811      do_action('save_post', $post_ID, $post);
1812      do_action('wp_insert_post', $post_ID, $post);
1813
1814      return $post_ID;
1815 }
1816
1817 /**
1818  * Update a post with new post data.
1819  *
1820  * The date does not have to be set for drafts. You can set the date and it will
 
Line Code
1894      wp_transition_post_status('publish', $old_status, $post);
1895
1896      // Update counts for the post's terms.
1897      foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
1898           $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
1899           wp_update_term_count($tt_ids, $taxonomy);
1900      }
1901
1902      do_action('edit_post', $post_id, $post);
1903      do_action('save_post', $post_id, $post);
1904      do_action('wp_insert_post', $post_id, $post);
1905 }
1906
1907 /**
1908  * Publish future post and make sure post ID has future post status.
1909  *
1910  * Invoked by cron 'publish_future_post' event. This safeguard prevents cron
1911  * from publishing drafts, etc.
1912  *