The Robservatory

Robservations on everything…

 

Add Drafts to WordPress admin sidebar

One of the things that annoys me about WordPress’ admin side is that to get to draft versions of posts, you have to first select Posts > All Posts, wait for that page to load, then select Drafts. The majority of the time, when I’m headed to my posts, I’m headed to the drafts section to work on an upcoming post.

This little modification adds a Drafts entry to the Posts sidebar item, as seen in this before-and-after view:

The change is relatively trivial, requiring only a simple edit to your theme’s functions.php file. David Walsh explains it all in this thorough post. I’ve recreated the bit of code in the remainder of this post, just in case the linked site ever goes away. (It’s all under the MIT License, so there are no restrictions on copying.)

But really, just go read David’s post, he explains it very well. I’ve added this to the admin page on the three sites I run, because it’s just so convenient.

Here’s the code to add to your theme’s functions.php, just in case the linked site vanishes:

Just add that code, save the changes, and you should have a shiny new direct-to-Drafts link in your admin sidebar.

2 Comments

Add a Comment
    1. Honestly, I’m not sure—you’d be better off asking David Walsh, who wrote the original. With that said, there is a add_pages_page function, so you could probably replicate most of the above, changing the function name you’re creating, and replacing post with page where appropriate.

      -rob.

Leave a Reply

The Robservatory © 2018 • Privacy Policy Built from the Frontier theme