How to add a drafts link to your WordPress posts menu with a plugin

Protect your baby bird WordPress functions inside the warm nest of a plugin. Image via flickr/Alex Proimos. Generic (CC BY-NC 2.0).

David Walsh has the secret sauce for getting a link to your post drafts in the posts menu option of your WordPress site. Yes!

I built upon his work and created a custom plugin that does the same. Why?

Because I hate it when a site update wipes out my functions.php custom code. By using a plugin, you can keep this handy-dandy shortcut secure amid the next upgrade.

To do this, just copy the code below into a text file, save it as yourspecialsecretsauce.php, drop it into your plugins directory, and activate it.


Plugin Name: Drafts Link in Posts Menu
Plugin URI:
Description: Adds a link to draft items from the Posts admin menu. took David's work and made it into a plugin.
Version: 1.0

function add_drafts_admin_menu_item() {
  // $page_title, $menu_title, $capability, $menu_slug, $callback_function
  /* add_posts_page(__('Drafts'), __('Drafts'), 'read', 'edit.php?post_status=draft&amp;post_type=post');
  add_pages_page(__'Drafts'), __('Drafts'), 'read', 'edit.php?post_status=draft&amp;post_type=page');
} */

  // $page_title, $menu_title, $capability, $menu_slug, $callback_function
  add_posts_page('Drafts', 'Drafts', 'read', 'edit.php?post_status=draft&amp;post_type=post');
  add_pages_page('Drafts', 'Drafts', 'read', 'edit.php?post_status=draft&amp;post_type=page');

add_action('admin_menu', 'add_drafts_admin_menu_item');


2 thoughts on “How to add a drafts link to your WordPress posts menu with a plugin”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: