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 |
---|---|
529 | global $wpdb; |
530 | $postid = (int) $postid; |
531 |
|
532 | if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") ) |
533 | return $post; |
534 |
|
535 | if ( 'attachment' == $post->post_status ) |
536 | return wp_delete_attachment($postid); |
537 |
|
538 | do_action('delete_post', $postid); |
539 |
|
540 | if ( 'publish' == $post->post_status) { |
541 | $categories = wp_get_post_cats('', $post->ID); |
542 | if( is_array( $categories ) ) { |
543 | foreach ( $categories as $cat_id ) { |
544 | $wpdb->query("UPDATE $wpdb->categories SET category_count = category_count - 1 WHERE cat_ID = '$cat_id'"); |
545 | wp_cache_delete($cat_id, 'category'); |
546 | } |
547 | } |