How to change multiple post status from ‘draft’ to ‘publish’
I am writing this post as I had managed to create loads of ‘draft’ posts (2,383 to be exact) that I wanted to set to ‘publish’. I am not a software engineer of php/sql expert just a simple blogger.
The normal method for doing this, for less than 100 posts, is to do the following;
- In Admin mode go to “All Posts”
- Under the “Howdy, admin” (logout icon) you will see two boxes (Screen Options | Help) , click the down arrow by the side of the “Screen Options”
- “Show on screen” will display some tick box options, one of the options is a list box “posts”. Update this to a maximum of 100 (50 is recommended) you can enter any number you like but you will probably find the page/server times out with an error or your hosting resources are exceeded. Click apply!
- Next click on “draft”to filter only the draft posts
- Select/tick the “select all” box on the left of the screen – this will add a tick to the first 50 or so draft posts
- On the left of the screen is a list box (Bulk Actions | Edit | Move to Trash) – Select “Edit”.
- This will display a “Bulk Edit” options box – Change the Status list box to “Published” – Click Update! Please be PATIENT this may take a while to process …
The alternate method for more than 100 posts is to do the following;
Please note: This is not for the faint hearted editing the back office sql database can cause significant site issues if you make a mistake.
PLEASE BACK UP YOU DATABASE BEFORE YOU START
- Login to you cPanel (Control Panel), scroll down to “Databases” and click on “phpMyAdmin”. This will launch a new tab (something like “localhost | phpMyAdmin 4.1.8″.
- On the left hand sidebar select the relevant database to the WordPress installation (website) you want to edit. You would have named this during the WordPress installation. This will display a table structure with a range of tabs at the top.
- On the left hand sidebar select “wp_posts” (note that the “wp_” prefix is the WordPress standard you may have chosen to customise the table prefixes with your own convention.
- Select the “SQL” tab. This will display an empty dialogue box, note if the dialogue box already contains scripts – delete these so the box is clear or click the clear button on the bottom middle of the dialogue box.
- Paste the following script below exactly as shown below and click the “Go” button – bottom right:
UPDATE wp_posts SET post_status=’publish’ WHERE post_status = ‘draft’
That’s it – you should now get a message something like; ” 2838 rows affected. (Query took 0.1344 sec)“
I hope this was of help to anybody out there as it took me a while to work out how to do this despite hours of google searches.