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 3 times in this file.
Line | Code |
---|---|
1776 | if ( !empty($post_meta_ids) ) { |
1777 | do_action( 'delete_postmeta', $post_meta_ids ); |
1778 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
1779 | $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); |
1780 | do_action( 'deleted_postmeta', $post_meta_ids ); |
1781 | } |
1782 |
|
1783 | do_action( 'delete_post', $postid ); |
1784 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); |
1785 | do_action( 'deleted_post', $postid ); |
1786 |
|
1787 | if ( 'page' == $post->post_type ) { |
1788 | clean_page_cache($postid); |
1789 |
|
1790 | foreach ( (array) $children as $child ) |
1791 | clean_page_cache($child->ID); |
1792 |
|
1793 | $wp_rewrite->flush_rules(false); |
1794 | } else { |
1795 | clean_post_cache($postid); |
1796 | } |
1797 |
|
1798 | wp_clear_scheduled_hook('publish_future_post', array( $postid ) ); |
1799 |
|
1800 | do_action('deleted_post', $postid); |
1801 |
|
1802 | return $post; |
1803 | } |
1804 |
|
1805 | /** |
1806 | * Moves a post or page to the Trash |
1807 | * |
1808 | * If trash is disabled, the post or page is permanently deleted. |
1809 | * |
Line | Code |
3474 | if ( !empty($post_meta_ids) ) { |
3475 | do_action( 'delete_postmeta', $post_meta_ids ); |
3476 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
3477 | $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); |
3478 | do_action( 'deleted_postmeta', $post_meta_ids ); |
3479 | } |
3480 |
|
3481 | do_action( 'delete_post', $post_id ); |
3482 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id )); |
3483 | do_action( 'deleted_post', $post_id ); |
3484 |
|
3485 | $uploadpath = wp_upload_dir(); |
3486 |
|
3487 | if ( ! empty($meta['thumb']) ) { |
3488 | // Don't delete the thumb if another attachment uses it |
3489 | if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $meta['thumb'] . '%', $post_id)) ) { |
3490 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |
3491 | $thumbfile = apply_filters('wp_delete_file', $thumbfile); |
3492 | @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); |