如果我正确理解了这个问题,你会想要这样的东西:
为此,对全球$submenu
必须:
// Priority 999 == execute this the latest as possible
add_action( \'admin_menu\', \'move_profile_submenu_wpse_43053\', 999 );
function move_profile_submenu_wpse_43053()
{
global $submenu;
// Get the key for the submenu Users.php -> Profile.php
$replace = find_profile_key_wpse_43053( $submenu[\'users.php\'] );
if( $replace )
{
$submenu[\'index.php\'][] = $submenu[\'users.php\'][ $replace ];
unset( $submenu[\'users.php\'][ $replace ] );
}
}
function find_profile_key_wpse_43053( $sub_menu )
{
foreach( $sub_menu as $key => $value )
if( in_array( \'profile.php\', $value ) )
return $key;
return false;
}