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 |
|---|---|
| 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 | |
| 2020 | $wp_rewrite->flush_rules(false); |
| 2021 | } else { |
| 2022 | clean_post_cache($postid); |
| 2023 | } |
| 2024 | |
| 2025 | wp_clear_scheduled_hook('publish_future_post', array( $postid ) ); |
| 2026 | |
| 2027 | do_action('deleted_post', $postid); |
| 2028 | |
| 2029 | return $post; |
| 2030 | } |
| 2031 | |
| 2032 | /** |
| 2033 | * Moves a post or page to the Trash |
| 2034 | * |
| 2035 | * If trash is disabled, the post or page is permanently deleted. |
| 2036 | * |
| Line | Code |
| 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); |
| 3733 | $thumbfile = apply_filters('wp_delete_file', $thumbfile); |
| 3734 | @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); |