Remove menus in back-office

How can I remove one or several items in WordPress back-office?

Add this code to your plugin:

[php]
<?php
// Remove toolbar menus
if ( !is_super_admin() ) add_action( ‘admin_menu’, ‘wpster_remove_menus’ );
function wpster_remove_menus() {
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’ ); //Apparence
remove_menu_page( ‘plugins.php’ ); //Plugins
remove_menu_page( ‘users.php’ ); //Users
remove_menu_page( ‘tools.php’ ); //Outils
remove_menu_page( ‘options-general.php’ ); //Settings
remove_menu_page( ‘edit.php?post_type=acf-field-group’ ); //ACF
}
?>
[/php]

Please note that you’ll only remove items, not their access!

Submit a Comment

Your email address will not be published. Required fields are marked *