I need to create an “Empty Trash” button inside my plugin. How would I do it using PHP code?
Leave a Reply
You must be logged in to post a comment.
I need to create an “Empty Trash” button inside my plugin. How would I do it using PHP code?
You must be logged in to post a comment.
You can use
wp_delete_post
.To get all posts with the “trash” status:
$trash = get_posts('post_status=trash&numberposts=-1');
Then:
This didn’t work for me. I had to do the following: