Change default tab shown in Posts/Pages admin

When it comes to writing new stuff and editing existing materials on your site, you will spend most of the time browsing through posts and pages where most of your articles will be located. As you probably already know, there are several tabs (categories) in which your posts and pages are divided into.

By default, “All Posts” and “All Pages” links in the WP admin will take you directly to all of your posts/pages. You will get the entire list of posts and pages, and if you decide that you want to list only published posts, drafts or only private ones, you have to switch a tab which appears as a small link on top of the list.

It’s not that hard to simply switch tabs, but if you tend to switch to “published” or let’s say “drafts” tabs more often than not, you can make everything quicker and code your WordPress in order to show that specific tab as the default one.

Not only it will save you a click, but you won’t have to reload the list every time you open it from the admin menu. It might sound like something not worth coding, but if you have a slower Internet connection it can be a nerve saver.

Change default tab:

Without further ado, here are functions which will help you:

  1. Open functions.php
  2. Copy and paste one of the two functions:

    function all_posts_tab() {
    global $submenu;
    $submenu['edit.php'][5][2] = 'edit.php?post_status=publish';
    add_action( 'admin_menu', ' all_posts_tab ' );


    function all_pages_tab() {
    global $submenu;
    $submenu['edit.php?post_type=page'][5][2] = 'edit.php?post_type=page&post_status=publish';
    add_action( 'admin_menu', all_pages_tab' );
  4. Save changes

Both functions shown above will change the default tab and show “published” posts and pages after you open the link. You can easily modify that to your needs and change the tab to previously mentioned “drafts” and “private” tabs.

If you want to do that, you will have to modify the 3rd row in code snippets shown above. All you have to do is to change post_status to one that you want as default:

PUBLISHED:   $submenu[‘edit.php’][5][2] = ‘edit.php?post_status=publish’;
DRAFT:    $submenu[‘edit.php’][5][2] = ‘edit.php?post_status=draft;
PRIVATE:    $submenu[‘edit.php’][5][2] = ‘edit.php?post_status=private;

The same rule goes for page changes – simply change that last word of the code to one that you want.

No matter which change do you make, that old “All” tab will stay active and you can always switch back to displaying all posts and pages as you used to. If you want to revert the changes, there’s no need in altering the code to switch back to showing all posts and pages – simply delete this function from your functions.php file or your site specific plugin file and it will be all back to normal.

Since you’re already working with the dashboard, you can add custom links to it, remove unnecessary widgets or completely remove a welcome panel.

Start Blog Book


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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