Answers:
您可以使用wp_delete_post
。
要获取所有具有“已删除邮件”状态的帖子,请执行以下操作:
$trash = get_posts('post_status=trash&numberposts=-1');
然后:
foreach($trash as $post)
wp_delete_post($post->ID, $bypass_trash = true);
这对我不起作用。我必须执行以下操作:
$args = array(
'posts_per_page' => -1,
'post_status' => 'trash'
);
$trash = get_posts($args);
foreach($trash as $post)
{
wp_delete_post($post->ID, true);
}