如果对WordPress功能有疑问,请咨询Codex:Function_Reference/remove_menu_page.
正确的功能是remove_submenu_page
连接到admin_menu
.
add_action( \'admin_menu\', \'remove_submenu_wpse_82873\' );
function remove_submenu_wpse_82873()
{
global $current_user;
get_currentuserinfo();
// If user not Super Admin remove export page
if ( !is_super_admin() )
{
remove_submenu_page( \'tools.php\', \'export.php\' );
}
}
然后您可能还想阻止通过URL地址直接访问该页面(
http://example.com/wp-admin/export.php
):
add_action( \'admin_head-export.php\', \'prevent_url_access_wpse_82873\' );
function prevent_url_access_wpse_82873()
{
global $current_user;
// Only Super Admin Authorized, exit if user not
if ( !is_super_admin() ) {
// User not authorized to access page, redirect to dashboard
wp_redirect( admin_url( \'index.php\' ) );
exit;
}
}