Change a WordPress Plugin’s Menu  Name

Safely change the name of a WordPress plugins admin menu using the following function.

If you want to change the wording of an admin menu inside of WordPress without editing the plugin directly you can make use of the $menu global variable that exists within the WordPress admin. Manipulating this data structure will allow you to change the text or name of an admin menu that was added by any plugin. This can be useful in situation where you want to provide clarity about what an item is, or to provide a better admin UX for a client.

To do this add the following bit of PHP to your theme’s functions.php file:

/**
 * Custom Plugin Menu Name(s)
 * 
 * Rename admin menus added by plugins
 */
function kl_rename_plugin_menus() {
    global $menu;

    // Define your changes here
    $updates = array(
        "miniOrange SAML 2.0 SSO" => array(
            'name' => 'SAML SSO',
            'icon' => 'dashicons-lock'
        )
    );

    foreach ( $menu as $k => $props ) {

        // Check for new values
        $new_values = ( isset( $updates[ $props[0] ] ) ) ? $updates[ $props[0] ] : false;
        if ( ! $new_values ) continue;

        // Change menu name
        $menu[$k][0] = $new_values['name'];

        // Optionally change menu icon
        if ( isset( $new_values['icon'] ) )
            $menu[$k][6] = $new_values['icon'];
    }
}
add_action( 'admin_init', 'kl_rename_plugin_menus' );

Once you’ve added this code you’ll want to change the values in the $updates array. The key is the name of the existing plugin menu that you currently see in WordPress and want to change. The value is an array of changes with two properties:

  • name — The new name you want to use for the plugin menu
  • icon — The icon you want to use, as an optional customization

For more information on replacing admin menu icons take a look at this WordPress dashicons reference write-up.

Meet the Author

Kevin Leary, WordPress Consultant

I'm a freelance web developer and WordPress consultant in Boston, MA with 17 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.