I can rename wp-admin menu items But How Can I active it for all users except Super Admin ?

add_filter('gettext', 'rename_admin_menu_items');
add_filter('ngettext', 'rename_admin_menu_items');
function rename_admin_menu_items( $menu ) {
$menu = str_ireplace( 'Dashboard', 'Home', $menu );
return $menu;
  • Which hook are you using? – kaiser Aug 14 '13 at 2:31
  • And where/when does that function run/gets executed? – kaiser Aug 14 '13 at 11:35
  • I'm sorry I was wrong ,I fixed the code. – Ghinnersmee Aug 14 '13 at 11:40
  • 2
    Never!, ever hook into gettext, ngettext and similar without instantly removing the attached callbacks! Those filters trigger hundreds of times on each request and can pull your site down to its knees. Seriously. Don't do this. – kaiser Aug 14 '13 at 11:48
 * Changes Label of Admin Menu items
 * @global array $menu
 * @global array $submenu
function change_post_menu_label() {
   global $menu;
   global $submenu;
   $menu[2][0] = 'Home'; 
   $menu[5][0] = 'Articles';
   $submenu['edit.php'][5][0] = "All Articles";
   //    var_dump($submenu);
   //    var_dump($menu);
    echo '';
    add_action( 'admin_menu', 'change_post_menu_label' );

You can print the array

echo "<pre>";
echo "</pre>"; //remove this code after, it is just used to check the index of element in Menu to rename it.

and see elements index to change name for whatever item you'would like to rename. Like in above function I'm renaming the "Posts" in menu to "Articles".

To rename the child of Menu item use


array. For renaming Dashboard to "Home"

  $menu[2][0] = 'Home'; 

add this line to previous function, confirm the index "2" in $menu array for Dashboard.

  • thanks bro...how can i rename the "Dashboard" menu to "Home"? – Ghinnersmee Aug 14 '13 at 11:35
  • I've updated the answer – Kumar Aug 14 '13 at 11:47

You need to check the user role. Setup a condition like this:

if(current_user_can("manage_network")) add_action("rename_admin_menu_items","your-hook");

References: User roles

  • doesn't work, How should the entire code? – Ghinnersmee Aug 14 '13 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.