Hide/Disable WordPress Menus in Admin Panel


As a web developer or site administrator, you understand the importance of streamlining the WordPress admin panel for both yourself and your users. By customizing the admin panel, you can create a more user-friendly experience and help your team members easily navigate the backend of your website.

One effective way to achieve this is by hiding or disabling certain menus in the admin panel. In this blog post, we’ll discuss the benefits of customizing the admin panel and guide you through different methods to hide or disable WordPress menus to create a cleaner, more efficient workspace.

There are several reasons why you might want to hide menus in the WordPress admin panel:

  1. Improved user experience: Hiding unnecessary or unused menus can create a cleaner and more streamlined admin panel, making it easier for users to find the options they need.
  2. Role-based access: In a multi-user environment, you may want to restrict access to specific menus based on user roles. By hiding certain menus, you can ensure that users only see the options relevant to their role, preventing accidental changes or unauthorized access to sensitive settings.
  3. Client management: If you’re developing a website for a client, you might want to simplify the admin panel to make it more user-friendly for non-technical users. Hiding advanced settings or options that your client doesn’t need can help reduce confusion and prevent unintended changes to the site.
  4. Custom branding: By removing default WordPress menus and adding your custom ones, you can create a more consistent branding experience in the admin panel, which can be particularly useful for agencies or businesses managing multiple websites.
  5. Focus on essential tasks: Hiding non-essential menus can help users concentrate on their primary tasks and avoid distractions, leading to increased productivity and efficiency in managing the website.

Overall, hiding menus in the admin panel can help create a more organized and user-friendly experience for both developers and end-users, ensuring that everyone can easily access the tools and options they need while minimizing the risk of accidental changes or unauthorized access.

Disable Theme Editor and Plugin Editor

Now, when we sent the admin panel to the customer with the login information, the customer can edit these parts, but we don’t want it to be this way. We don’t want customers to be able to make any edits. We can prevent this. From here, we can hide the plugin editor and the theme editor tabs and pages under Appearance.

In order to do this, I enter the functions.php in the theme file. I’m writing this code in a suitable part of the page.

define( 'DISALLOW_FILE_EDIT', true );

This code makes it impossible to edit files through the admin panel. Under Appearance, the theme editor is gone. And under Plugins the plugin editor is gone. In this case, I can say that there is a restriction to edit through this admin panel in any way.

The importance of this is that if your customers don’t understand the codes and try to edit these codes or ask someone else they think they know, this site may become unusable. Our aim is to prevent this.

Hide Menus / Pages in Admin Panel

To hide menus or pages in the WordPress admin panel by editing the functions.php file. Access your theme’s functions.php file. Add the following code snippet at the bottom of the functions.php file:

function 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' );                 //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
add_action( 'admin_menu', 'remove_menus' );

Disable Comments and Pages Menus in Admin Panel

To disable the “Comments” and “Pages” menus in the WordPress admin panel by editing the functions.php file, follow this. Add the following code snippet to the bottom of your functions.php file.

function remove_menus() {
  remove_menu_page('edit-comments.php'); // Removes the Comments menu
  remove_menu_page('edit.php?post_type=page'); // Removes the Pages menu
add_action('admin_menu', 'remove_menus');

After implementing this code, the “Comments” and “Pages” menus will be hidden in the WordPress admin panel. If you want to restore these menus in the future, simply remove the added code from your functions.php file and save your changes.

Hide the WordPress Dashboard (Index page) for Specific User Roles

To hide the WordPress Dashboard (Index page) for specific user roles, you can use custom code in your theme’s functions.php file.

function hide_dashboard_for_specific_roles() {
    if ( is_admin() && !current_user_can('administrator') ) {
        wp_redirect( home_url() );
add_action( 'admin_init', 'hide_dashboard_for_specific_roles' );

This code checks if the current user is not an administrator and, if so, redirects them to the home page instead of displaying the Dashboard.

Hide the Contact Form 7 Plugin Menu in the WordPress Admin Panel

To hide the Contact Form 7 plugin menu in the WordPress admin panel, you can add custom code to your theme’s functions.php file.


In conclusion, hiding menus in the WordPress admin panel can greatly improve user experience, streamline navigation, and enhance security by limiting access to specific features based on user roles.

By using plugins or custom code snippets, you can easily customize the admin panel to better suit the needs of your team or clients. Always remember to backup your files before making any changes and test the modifications on a staging site to ensure a smooth and error-free implementation.