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
1318      $post = get_post($post_ID);
1319      if ( !empty($page_template) )
1320           $post->page_template = $page_template;
1321
1322      wp_transition_post_status($post_status, $previous_status, $post);
1323
1324      if ( $update)
1325           do_action('edit_post', $post_ID, $post);
1326
1327      do_action('save_post', $post_ID, $post);
1328      do_action('wp_insert_post', $post_ID, $post);
1329
1330      return $post_ID;
1331 }
1332
1333 /**
1334  * wp_update_post() - Update a post
1335  *
1336  * {@internal Missing Long Description}}
 
Line Code
1412      wp_transition_post_status('publish', $old_status, $post);
1413
1414      // Update counts for the post's terms.
1415      foreach ( get_object_taxonomies('post') as $taxonomy ) {
1416           $terms = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
1417           wp_update_term_count($terms, $taxonomy);
1418      }
1419
1420      do_action('edit_post', $post_id, $post);
1421      do_action('save_post', $post_id, $post);
1422      do_action('wp_insert_post', $post_id, $post);
1423 }
1424
1425 /**
1426  * check_and_publish_future_post() - check to make sure post has correct status before
1427  * passing it on to be published. Invoked by cron 'publish_future_post' event
1428  * This safeguard prevents cron from publishing drafts, etc.
1429  *
1430  * {@internal Missing Long Description}}