How To Change WP Admin Menu Item Names

I recently ran into an issue where I needed to have both the Ninja Forms plugin and the Gravity Forms plugin installed on the same website. While that may sound a bit ridiculous, I promise that it was actually necessary!

After checking to make sure that they plugins wouldn’t run into each other as far as admin pages were concerned the next thing I needed to address was that in the WordPress admin area both plugins use the exact same name for their menu items.

After searching around for while I figured out a way to do this by adding an action to my themes functions.php file that would run through each menu item and change the name of the conflicting two menu items.

function rename_forms_menu_item() {

	global $menu;

	foreach ( $menu as $key => $item ) {

		if ( $item[2] === 'ninja-forms' ) {
			$menu[ $key ][0] = __( 'Ninja Forms', 'textdomain' );
		}

		if ( $item[2] === 'gf_edit_forms' ) {
			$menu[ $key ][0] = __( 'Gravity Forms', 'textdomain' );
		}
	}

	return false;
}
add_action( 'admin_menu', 'rename_forms_menu_item', 999 );

To figure out what exactly the corresponding string you need to match is you’ll probably want to drop a <print_r( $item ); in there. Just don’t forget to remove your print_r statement!