WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/trash post

Run actions when a post, page, or custom post type is about to be trashed. The post ID is passed to the action hook.

Example:

Parameters

$postid
(integer) (required) The ID of the post, page, or custom post type being deleted.
Default: None

 add_action( 'trash_post', 'function_to_run_on_post_trash' );
 function function_to_run_on_post_trash( $post_id ) {
   // trash a related post or fire notice
   
 }

This page is marked as incomplete. You can help Codex by expanding it.