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.
This hook occurs 2 times in this file.
Line | Code |
---|---|
406 |
|
407 | do_action('delete_post', $postid); |
408 |
|
409 | if ( 'publish' == $post->post_status && 'post' == $post->post_type ) { |
410 | $categories = wp_get_post_categories($post->ID); |
411 | if( is_array( $categories ) ) { |
412 | foreach ( $categories as $cat_id ) { |
413 | $wpdb->query("UPDATE $wpdb->categories SET category_count = category_count - 1 WHERE cat_ID = '$cat_id'"); |
414 | wp_cache_delete($cat_id, 'category'); |
415 | do_action('edit_category', $cat_id); |
416 | } |
417 | } |
418 | } |
419 |
|
420 | if ( 'page' == $post->post_type ) |
421 | $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'"); |
422 |
|
423 | $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'attachment'"); |
424 |
|
Line | Code |
811 | } |
812 | } |
813 |
|
814 | // Update category counts. |
815 | $all_affected_cats = array_unique(array_merge($post_categories, $old_categories)); |
816 | foreach ( $all_affected_cats as $cat_id ) { |
817 | $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); |
818 | $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); |
819 | clean_category_cache($cat_id); |
820 | do_action('edit_category', $cat_id); |
821 | } |
822 | } // wp_set_post_categories() |
823 |
|
824 | // |
825 | // Trackback and ping functions |
826 | // |
827 |
|
828 | function add_ping($post_id, $uri) { // Add a URL to those already pung |
829 | global $wpdb; |