WordPress.org

Codex

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

Function Reference/wp trash post

Description

Moves a post or page to the Trash

If trash is disabled, the post or page is permanently deleted.

Usage

 <?php wp_trash_post$post_id  ); ?>

Parameters

$post_id
(integer) (optional) Post ID.
Default: 0

Return Values

(mixed) 
False on failure.

Examples

Trash the default WordPress Post, "Hello World," which has an ID of '1'. <?php wp_trash_post); ?>

Notes

Change Log

Since: 2.9.0

Source File

wp_trash_post() is located in wp-includes/post.php.

Related

Post, Page, Attachment and Bookmarks Functions: wp_delete_post(), wp_update_post(), wp_delete_attachment(), wp_insert_attachment(), wp_insert_post()

See also index of Function Reference and index of Template Tags.