Web Analytics

WordPress Tweaks: Rearrange Admin Menu Links

by Jason Unger, Founder

When we build WordPress sites, we almost always re-arrange the menu items in the admin area. It lets us prioritize the content our partner is going to need to access, while removing content that may be unnecessary.

Usually, that means doing the following:

  • Moving the “Pages” link up, directly below the “Dashboard” link
  • Moving “Posts” down, now beneath “Pages”
  • Removing access to the “Comments” section

These changes make sense when the website isn’t a blog first and commenting isn’t allowed anywhere.

Making these tweaks is relatively easy, especially if you’re comfortable working with your site’s functions.php file.

How to Rearrange Your WordPress Admin Menu Links

There are two WordPress functions that make this magic happen.

This function creates a custom menu order to replace the normal menu order:

add_filter( 'custom_menu_order', 'dgtlnk_custom_menu_order', 10, 1 );
add_filter( 'menu_order', 'dgtlnk_custom_menu_order', 10, 1 );
function dgtlnk_custom_menu_order( $menu_ord ) {
     if ( !$menu_ord ) return true;
     return array(
          'index.php', // Dashboard
          'separator1', // First separator
          'edit.php?post_type=page', // Pages
          'edit.php', // Posts
     );
}

This function removes pages from the menu; in this example, the Comments link is removed.

add_action( 'admin_menu', 'dgtlnk_remove_menus' );
function dgtlnk_remove_menus(){
     remove_menu_page( 'edit-comments.php' );
}

Building Your Own Custom Menu Order

Using these functions to re-arrange the menu items for your project is easy enough.

Simply take the menu items you want, grab their URL slug (everything past the /wp-admin/), and re-order as in the first function. Add separators as necessary.

If you don’t add an item to your custom menu order, and don’t remove it completely, it will fall in line below your custom order.

So if you only want to re-order the first few menu items (as seen above), everything else will display in its normal order below the customizations you’ve made.

To remove links from the menu, simply insert the page’s slug (URL) in the “remove_menu_page” function. To remove multiple pages, call the function multiple times for each page you want to remove.

Avatar photo
About Jason Unger

Jason Unger is the Founder of Digital Ink. He built his first website on Geocities, and hasn't looked back since. Digital Ink tells stories for forward-thinking businesses, mission-driven organizations, and marketing and technology agencies in need of a creative and digital partner.

Other Stories You May Like

What’s your story?

Let’s share it with the world.

Let’s Do This

Close Window
All the Cool Kids are Doing it

Sign Up for the Digital Ink Newsletter

All the cool kids are doing it.