Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_insert_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
1592           update_post_meta($post_ID, '_wp_page_template',  $page_template);
1593      }
1594
1595      wp_transition_post_status($data['post_status'], $previous_status, $post);
1596
1597      if ( $update)
1598           do_action('edit_post', $post_ID, $post);
1599
1600      do_action('save_post', $post_ID, $post);
1601      do_action('wp_insert_post', $post_ID, $post);
1602
1603      return $post_ID;
1604 }
1605
1606 /**
1607  * Update a post with new post data.
1608  *
1609  * The date does not have to be set for drafts. You can set the date and it will
1610  * not be overridden.
 
Line Code
1684
1685      // Update counts for the post's terms.
1686      foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
1687           $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
1688           wp_update_term_count($tt_ids, $taxonomy);
1689      }
1690
1691      do_action('edit_post', $post_id, $post);
1692      do_action('save_post', $post_id, $post);
1693      do_action('wp_insert_post', $post_id, $post);
1694 }
1695
1696 /**
1697  * Publish future post and make sure post ID has future post status.
1698  *
1699  * Invoked by cron 'publish_future_post' event. This safeguard prevents cron
1700  * from publishing drafts, etc.
1701  *
1702  * @since 2.5.0