WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 506 | global $wpdb, $wp_rewrite; |
| 507 | $postid = (int) $postid; |
| 508 | |
| 509 | if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") ) |
| 510 | return $post; |
| 511 | |
| 512 | if ( 'attachment' == $post->post_type ) |
| 513 | return wp_delete_attachment($postid); |
| 514 | |
| 515 | do_action('delete_post', $postid); |
| 516 | |
| 517 | // TODO delete for pluggable post taxonomies too |
| 518 | wp_delete_object_term_relationships($postid, array('category', 'post_tag')); |
| 519 | |
| 520 | if ( 'page' == $post->post_type ) |
| 521 | $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'"); |
| 522 | |
| 523 | $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'attachment'"); |
| 524 | |