Hack: Add a Link To Your Posts Page In the Admin Menu Bar

There is one main page I go to in the WordPress controls more than any other. It is the Posts page that lists all of the posts. This is where, as a content creator, I live. I go here to see what is scheduled, to go into any drafts I need to complete, and to start a new post. Yet there is no link to this page in the WordPress menu bar. Beats me why.

Fortunately, you can add it. The location is simply /wp-admin.edit.php. Adding it to the menu bar is just a matter of using the admin_bar_menu hook. Here is some code you can place in your functions.php or custom plugin.

function wpaction_add_toolbar_posts($wp_admin_bar) {
	$args = array('id' => 'posts', 'title' => 'Posts', 'href' => '/wp-admin/edit.php');
	$wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'wpaction_add_toolbar_posts', 99);

This code is a very simple call to add_node. A standard call actually takes a few more arguments. You can get pretty complex with it too, creating a whole menu with items. See the Codex page for some more detailed examples.

Leave a Reply

Your email address will not be published. Required fields are marked *