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
1096 function wp_delete_post($postid = 0) {
1097      global $wpdb, $wp_rewrite;
1098
1099      if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
1100           return $post;
1101
1102      if ( 'attachment' == $post->post_type )
1103           return wp_delete_attachment($postid);
1104
1105      do_action('delete_post', $postid);
1106
1107      /** @todo delete for pluggable post taxonomies too */
1108      wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
1109
1110      $parent_data = array( 'post_parent' => $post->post_parent );
1111      $parent_where = array( 'post_parent' => $postid );
1112
1113      if ( 'page' == $post->post_type) {
1114            // if the page is defined in option page_on_front or post_for_posts,