Quantcast
Viewing latest article 3
Browse Latest Browse All 4

[WordPress LazyAdmin]: Make all posts private in 5 seconds

I enjoy monkeying around with WordPress, it’s a fun platform and amazingly flexible. Recently, I needed to take a site private – leaving only a single static page as a “front page” placeholder. Looking dubiously at the post counts, I realized, in typically “LazyAdmin” mode, that this entailed manually clicking through hundreds of posts and checking off “Private” on each one. Not a good way to spend time. Good Admins are lazy admins, and seek a quick ‘n clean (no, NOT “quick ‘n dirty, we don’t like that) way of accomplishing their goals.

Our good friend MySQL to the rescue! In under 5 seconds the goal was accomplished (with one single gotcha which I’ll cover in just a moment)

This hack, of course, assumes you have SSH access, sufficient privileges to launch the MySQL client, and working familiarity with the MySQL command line. It’s my damn server, so I have all three prerequisites covered in one shot. WooHoo.

Let’s get to the code;

mysql> UPDATE wp_posts SET post_status = 'private';

Now here’s the gotcha. IF you created a specific page to be used as your static placeholder, then the above command doesn’t distinguish between posts or pages. It takes all of ’em and sets ’em to private. Looking in “Settings | Reading” shows no option for selecting a static front page! This isn’t a problem, don’t sweat it.

Go to the “Pages” section of your admin view, locate the desired page, hover over the title until the four options “Edit | Quick Edit | Trash | View” are revealed, and click on “Quick Edit”. Uncheck “Private”, save, and you’re done. Now follow the normal procedure to set a static front page under “Settings | Reading”, you’ll now see the option to select a static page once more. As usual, hit the dropdown and select the name of the page (there will only be one visible in the dropdown) that you want as the static front page.

Voila, you’re done.

Stay tuned for other occasional “LazyAdmin” timesaving tips & tricks.


Viewing latest article 3
Browse Latest Browse All 4

Trending Articles