delete_post

The WordPress Core delete post hook.

Description

add_action( 'delete_post', (string) $update_posts_count_on_delete ); 

Parameters (1)

0. $update_posts_count_on_delete (string) => '_update_posts_count_on_delete'
The update posts count on delete.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'delete_post', $update_posts_count_on_delete ); 
The following example is for adding a hook callback.
  1. // define the delete_post callback 
  2. function action_delete_post( $update_posts_count_on_delete ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'delete_post', 'action_delete_post', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'delete_post', 'action_delete_post', 10, 1 ); 

Defined (4)

The action is defined in the following location(s).

/wp-includes/ms-default-filters.php  
  1. add_action( 'delete_post', '_update_posts_count_on_delete' ); 
  1. add_action( 'delete_post', '_update_blog_date_on_post_delete' ); 
/wp-includes/default-filters.php  
  1. add_action( 'delete_post', '_wp_delete_post_menu_item' ); 
  1. add_action( 'delete_post', 'delete_get_calendar_cache' );