How to change the admin menu “Pages” to something else

Another easy one! 🙂

As you know I think very highly of WordPress in general, but the admin menu architecture is one of the nastiest hacks I think I’ve ever seen in open-source software. What’s only greater in magnitude is the core WordPress team’s unwillingness to acknowledge how bad it is and their lack of willingness to discuss improving it. But I digress…

Anyway, here’s what you want (I think):

Screenshot of a WordPress admin menu modified to
(source: mikeschinkel.com)

And here’s how to get it:

add_action('admin_menu','rename_pages_to_main_sections');
function rename_pages_to_main_sections() {
  global $menu;
  global $submenu;
  $menu[20][0] = 'Main Sections';
  $submenu['edit.php?post_type=page'][5][0] = 'Main Sections';
}

P.S. Also, you might find the code I posted here helpful too: