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 |
|---|---|
| 1946 | if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) |
| 1947 | return $post; |
| 1948 | |
| 1949 | if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS ) |
| 1950 | return wp_trash_post($postid); |
| 1951 | |
| 1952 | if ( $post->post_type == 'attachment' ) |
| 1953 | return wp_delete_attachment( $postid, $force_delete ); |
| 1954 | |
| 1955 | do_action('delete_post', $postid); |
| 1956 | |
| 1957 | delete_post_meta($postid,'_wp_trash_meta_status'); |
| 1958 | delete_post_meta($postid,'_wp_trash_meta_time'); |
| 1959 | |
| 1960 | wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type)); |
| 1961 | |
| 1962 | $parent_data = array( 'post_parent' => $post->post_parent ); |
| 1963 | $parent_where = array( 'post_parent' => $postid ); |
| 1964 | |
| Line | Code |
| 2001 | |
| 2002 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); |
| 2003 | if ( !empty($post_meta_ids) ) { |
| 2004 | do_action( 'delete_postmeta', $post_meta_ids ); |
| 2005 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
| 2006 | $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); |
| 2007 | do_action( 'deleted_postmeta', $post_meta_ids ); |
| 2008 | } |
| 2009 | |
| 2010 | do_action( 'delete_post', $postid ); |
| 2011 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); |
| 2012 | do_action( 'deleted_post', $postid ); |
| 2013 | |
| 2014 | if ( 'page' == $post->post_type ) { |
| 2015 | clean_page_cache($postid); |
| 2016 | |
| 2017 | foreach ( (array) $children as $child ) |
| 2018 | clean_page_cache($child->ID); |
| 2019 | |
| Line | Code |
| 3714 | |
| 3715 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); |
| 3716 | if ( !empty($post_meta_ids) ) { |
| 3717 | do_action( 'delete_postmeta', $post_meta_ids ); |
| 3718 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
| 3719 | $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); |
| 3720 | do_action( 'deleted_postmeta', $post_meta_ids ); |
| 3721 | } |
| 3722 | |
| 3723 | do_action( 'delete_post', $post_id ); |
| 3724 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id )); |
| 3725 | do_action( 'deleted_post', $post_id ); |
| 3726 | |
| 3727 | $uploadpath = wp_upload_dir(); |
| 3728 | |
| 3729 | if ( ! empty($meta['thumb']) ) { |
| 3730 | // Don't delete the thumb if another attachment uses it |
| 3731 | 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)) ) { |
| 3732 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |