delete_post

The WordPress Core delete post hook.

Description

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

Parameters (1)

0. $wp_delete_post_menu_item (string) => '_wp_delete_post_menu_item'
The wp delete post menu item.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'delete_post', $wp_delete_post_menu_item ); 
The following example is for adding a hook callback.
  1. // define the delete_post callback 
  2. function action_delete_post( $wp_delete_post_menu_item ) { 
  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 (6)

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

/wp-includes/default-filters.php  
  1. add_action( 'delete_post', '_wp_delete_post_menu_item' ); 
  1. add_action( 'delete_post', 'delete_get_calendar_cache' ); 
/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/post.php  
  1. do_action( 'delete_post', $postid ); 
  1. do_action( 'delete_post', $post_id );