Skip to content

Renaming a Menu Item In WordPress

Pexels / Pixabay

First of all you might want to see all the data in the menu array in the backend. To do this simply drop this snippet in your child themes function.php file.

if (!function_exists('debug_admin_menus')):
function debug_admin_menus() {
    global $submenu, $menu, $pagenow;
    if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN
        if( $pagenow == 'index.php' ) {  // PRINTS ON DASHBOARD
            echo '<pre>'; print_r( $menu ); echo '</pre>'; // TOP LEVEL MENUS
            echo '<pre>'; print_r( $submenu ); echo '</pre>'; // SUBMENUS
        }
    }
}
add_action( 'admin_notices', 'debug_admin_menus' );
endif;

This displays the complete wordpress admin menu on your dashboard for admin only. You scroll down in this list until you see the plugn you want to rename. Get the number from the key of this array item. Then you head back to functions.php and paste this function:

function menu_page_removal() {

    global $menu;

    // Rename the plugins menu name to something else
    $menu[26][0] = __('NEW NAME','textdomain');

}
add_action( 'admin_menu', 'menu_page_removal' , 999);

Save your functions and take a look in your dashboard. The according plugin should be renamed to whatever you wanted. If everything works correct you can remove the first function debug_admin_menus , since its only for debugging. This works for most other menu items as well

Dieser Beitrag hat 3 Kommentare

Schreibe einen Kommentar zu Thanh Thai Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen