Archivio mensile:settembre 2021

How to bulk publish or bulk delete pending posts in WordPress

Do you have many posts to edit on your WordPress website and you do not know how to do it? Actually, the WordPress editor doesn’t offer much in bulk editing: it only allows you to edit 10 posts at a time. Therefore, when there are a lot of pending posts to publish or delete this can be a problem. There is, anyway, a quick way to bulk edit posts.

Bulk edit from PhpMyAdmin

As you all know WordPress is a CMS that is installed on your server and which put the data in a database. Therefore you just have to go to the control panel (usually Cpanel) of your hosting provider and search PhpMyAdmin in the search bar (PhpMyAdmin is the app controlling databases of your sites, so we are going to bulk delete posts directly from there). So enter in PhpMyAdmin and search the database of your WordPress site (usually there is one database for each one of your WordPress websites). Once found the database containing your website posts you will find there are many tables in it. You should click in the one named “wp_posts” or “wpkn_posts”. In that table you will find the list of your wordpress posts and their current status, if published, pending or draft.

click to enlarge

So let’s do some edit. Click on the button SQL from the menu at the top of the page (see previous image to find it).

So once clicked, run this code in the white table:

UPDATE wpkn_posts (or wp_posts) SET post_status = ‘publish’ WHERE post_status = ‘pending’

in the case you want to bulk publish many posts.

When you want to bulk delete many posts run this other code:

DELETE FROM wpkn_posts (or wp_posts) WHERE post_status = ‘pending’  (or ‘publish’, or ‘draft’)