wp_delete_post
wp_delete_post ( $post_id = 0, $force_delete = false )
Parameters:- (int) post_id Optional. Post ID. Default 0.
- (bool) force_delete Optional. Whether to bypass Trash and force deletion. Default false.
See:Returns:- (WP_Post|false|null) Post data on success, false or null on failure.
Defined at: - Introduced in WordPress: 1.0.0
- Deprecated in WordPress: —
Description
Trashes or deletes a post or page.When the post and page is permanently deleted, everything that is tied to
it is deleted also. This includes comments, post meta fields, and terms
associated with the post.
The post or page is moved to Trash instead of permanently deleted unless
Trash is disabled, item is already in the Trash, or $force_delete is true.