Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: deleted_postmeta

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
707           return false;
708
709      global $wpdb;
710      $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key));
711      if ( $post_ids ) {
712           $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) );
713           $in = implode( ',', array_fill(1, count($postmetaids), '%d'));
714           do_action( 'delete_postmeta', $postmetaids );
715           $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids ));
716           do_action( 'deleted_postmeta', $postmetaids );
717           foreach ( $post_ids as $post_id )
718                wp_cache_delete($post_id, 'post_meta');
719           return true;
720      }
721      return false;
722 }
723
724 /**
725  * Retrieve post meta fields, based on post ID.
 
Line Code
1227           $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_ID IN($in_comment_ids)" );
1228           do_action( 'deleted_comment', $comment_ids );
1229      }
1230
1231      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
1232      if ( !empty($post_meta_ids) ) {
1233           do_action( 'delete_postmeta', $post_meta_ids );
1234           $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'";
1235           $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" );
1236           do_action( 'deleted_postmeta', $post_meta_ids );
1237      }
1238
1239      do_action( 'delete_post', $postid );
1240      $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
1241      do_action( 'deleted_post', $postid );
1242
1243      if ( 'page' == $post->post_type ) {
1244           clean_page_cache($postid);
1245
 
Line Code
2863           $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_ID IN($in_comment_ids)" );
2864           do_action( 'deleted_comment', $comment_ids );
2865      }
2866
2867      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
2868      if ( !empty($post_meta_ids) ) {
2869           do_action( 'delete_postmeta', $post_meta_ids );
2870           $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'";
2871           $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" );
2872           do_action( 'deleted_postmeta', $post_meta_ids );
2873      }
2874
2875      do_action( 'delete_post', $post_id );
2876      $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id ));
2877      do_action( 'deleted_post', $post_id );
2878
2879      $uploadpath = wp_upload_dir();
2880
2881      if ( ! empty($meta['thumb']) ) {