WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp trash post

Contents

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 Post

Trash WP default post "Hello World" which ID is '1'.

 <?php wp_trash_post(1); ?> 

Notes

Change Log

Since: 2.9.0

Source File

wp_delete_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.