wordpress 如何移除后台的菜单

wordpresss 可以非常方便的移除,后台的主菜单, 参数 index.php , edit.php ... 其实就是 url 中的内容。

wordpress移除后台的菜单
wordpress移除后台的菜单
add_action('admin_menu', function() {
	remove_menu_page( 'index.php' );                  //Dashboard
	remove_menu_page( 'edit.php' );                   //Posts
	remove_menu_page( 'upload.php' );                 //Media
	remove_menu_page( 'edit.php?post_type=page' );    //Pages
	remove_menu_page( 'edit-comments.php' );          //Comments
	remove_menu_page( 'themes.php' );                 //Appearance
	remove_menu_page( 'plugins.php' );                //Plugins
	remove_menu_page( 'users.php' );                  //Users
	remove_menu_page( 'tools.php' );                  //Tools
	remove_menu_page( 'options-general.php' );        //Settings
}, 999, 0);