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 |
|---|---|
| 1719 | if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) |
| 1720 | return $post; |
| 1721 | |
| 1722 | if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS ) |
| 1723 | return wp_trash_post($postid); |
| 1724 | |
| 1725 | if ( $post->post_type == 'attachment' ) |
| 1726 | return wp_delete_attachment( $postid, $force_delete ); |
| 1727 | |
| 1728 | do_action('delete_post', $postid); |
| 1729 | |
| 1730 | delete_post_meta($postid,'_wp_trash_meta_status'); |
| 1731 | delete_post_meta($postid,'_wp_trash_meta_time'); |
| 1732 | |
| 1733 | wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type)); |
| 1734 | |
| 1735 | $parent_data = array( 'post_parent' => $post->post_parent ); |
| 1736 | $parent_where = array( 'post_parent' => $postid ); |
| 1737 | |
| Line | Code |
| 1774 | |
| 1775 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); |
| 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 | |
| Line | Code |
| 3472 | |
| 3473 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); |
| 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); |