wp_delete_post


wp_delete_post ( $postid = 0, $force_delete = false )

Parameters:
  • (int) $postid 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:

Description

Trash or delete 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.

Related Functions

wp_delete_site, wp_ajax_delete_post, wp_remote_post, wp_update_post, wp_delete_user

Top Google Results

User discussions

wpseek mobile