Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_post

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
2405           delete_metadata_by_mid( 'post', $mid );
2406
2407      /**
2408       * Fires immediately before a post is deleted from the database.
2409       *
2410       * @since 1.2.0
2411       *
2412       * @param int $postid Post ID.
2413       */
2414      do_action( 'delete_post', $postid );
2415      $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
2416      if ( ! $result ) {
2417           return false;
2418      }
2419
2420      /**
2421       * Fires immediately after a post is deleted from the database.
2422       *
2423       * @since 2.2.0
 
Line Code
4783      }
4784
4785      wp_defer_comment_counting( false );
4786
4787      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
4788      foreach ( $post_meta_ids as $mid )
4789           delete_metadata_by_mid( 'post', $mid );
4790
4791      /** This action is documented in wp-includes/post.php */
4792      do_action( 'delete_post', $post_id );
4793      $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
4794      if ( ! $result ) {
4795           return false;
4796      }
4797      /** This action is documented in wp-includes/post.php */
4798      do_action( 'deleted_post', $post_id );
4799
4800      $uploadpath = wp_get_upload_dir();
4801