I need to create an "Empty Trash" button inside my plugin. How would I do it using PHP code?
You can use wp_delete_post.
To get all posts with the "trash" status:
$trash = get_posts('post_status=trash&numberposts=-1');
foreach($trash as $post)
wp_delete_post($post->ID, $bypass_trash = true);
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
1 year ago