Title: wp_trash_post
Published: April 25, 2014
Last modified: February 24, 2026

---

# do_action( ‘wp_trash_post’, int $post_id, string $previous_status )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#wp--skip-link--target)

Fires before a post is sent to the Trash.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#parameters)󠁿

 `$post_id`int

Post ID.

`$previous_status`string

The status of the post about to be trashed.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#source)󠁿

    ```php
    do_action( 'wp_trash_post', $post_id, $previous_status );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/post.php#L4050)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/post.php#L4050-L4050)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Customize_Manager::trash_changeset_post()](https://developer.wordpress.org/reference/classes/wp_customize_manager/trash_changeset_post/)`wp-includes/class-wp-customize-manager.php` |

Trashes or deletes a changeset post.

  | 
| [wp_trash_post()](https://developer.wordpress.org/reference/functions/wp_trash_post/)`wp-includes/post.php` |

Moves a post or page to the Trash

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.0/) | Added the `$previous_status` parameter. | 
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/wp_trash_post/?output_format=md#comment-content-4641)
 2.   [Riverlab](https://profiles.wordpress.org/riverlab/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/wp_trash_post/#comment-4641)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_trash_post%2F%23comment-4641)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_trash_post%2F%23comment-4641)
 4. To get the id of all posts that have been trashed when selecting multiples, you
    must use the
 5.     ```php
        $_GET['post']
        ```
    
 6. Like that example below:
 7.     ```php
        function wpdocs_trash_multiple_posts( $post_id = '' ) {
            // Verify if is trashing multiple posts
            if ( isset( $_GET['post'] ) && is_array( $_GET['post'] ) ) {
                foreach ( $_GET['post'] as $post_id ) {
                    wpdocs_your_function( $post_id );
                }
            } else {
                wpdocs_your_function( $post_id );
            }
        }
        add_action( 'wp_trash_post', 'wpdocs_trash_multiple_posts' );
        ```
    
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_trash_post%2F%3Freplytocom%3D4641%23feedback-editor-4641)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_trash_post%2F)
before being able to contribute a note or feedback.