Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_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 2 times in this file.

Line Code
2018      if ( ! empty($comment_ids) ) {
2019           do_action( 'delete_comment', $comment_ids );
2020           foreach ( $comment_ids as $comment_id )
2021                wp_delete_comment( $comment_id, true );
2022           do_action( 'deleted_comment', $comment_ids );
2023      }
2024
2025      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
2026      if ( !empty($post_meta_ids) ) {
2027           do_action( 'delete_postmeta', $post_meta_ids );
2028           $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'";
2029           $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" );
2030           do_action( 'deleted_postmeta', $post_meta_ids );
2031      }
2032
2033      do_action( 'delete_post', $postid );
2034      $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
2035      do_action( 'deleted_post', $postid );
2036
 
Line Code
3790      if ( ! empty( $comment_ids ) ) {
3791           do_action( 'delete_comment', $comment_ids );
3792           foreach ( $comment_ids as $comment_id )
3793                wp_delete_comment( $comment_id, true );
3794           do_action( 'deleted_comment', $comment_ids );
3795      }
3796
3797      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
3798      if ( !empty($post_meta_ids) ) {
3799           do_action( 'delete_postmeta', $post_meta_ids );
3800           $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'";
3801           $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" );
3802           do_action( 'deleted_postmeta', $post_meta_ids );
3803      }
3804
3805      do_action( 'delete_post', $post_id );
3806      $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id ));
3807      do_action( 'deleted_post', $post_id );
3808