Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_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

Line Code
966 function wp_delete_post($postid = 0) {
967      global $wpdb, $wp_rewrite;
968
969      if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
970           return $post;
971
972      if ( 'attachment' == $post->post_type )
973           return wp_delete_attachment($postid);
974
975      do_action('delete_post', $postid);
976
977      /** @todo delete for pluggable post taxonomies too */
978      wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
979
980      $parent_data = array( 'post_parent' => $post->post_parent );
981      $parent_where = array( 'post_parent' => $postid );
982
983      if ( 'page' == $post->post_type) {
984            // if the page is defined in option page_on_front or post_for_posts,