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
1137 function wp_delete_post($postid = 0) {
1138      global $wpdb, $wp_rewrite;
1139
1140      if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
1141           return $post;
1142
1143      if ( 'attachment' == $post->post_type )
1144           return wp_delete_attachment($postid);
1145
1146      do_action('delete_post', $postid);
1147
1148      /** @todo delete for pluggable post taxonomies too */
1149      wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
1150
1151      $parent_data = array( 'post_parent' => $post->post_parent );
1152      $parent_where = array( 'post_parent' => $postid );
1153
1154      if ( 'page' == $post->post_type) {
1155            // if the page is defined in option page_on_front or post_for_posts,