Title: Hiding menu items
Last modified: January 30, 2022

---

# Hiding menu items

 *  [Trippetchz](https://wordpress.org/support/users/trippetchz/)
 * (@trippetchz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/hiding-menu-items-3/)
 * Hi there,
 * I am trying to hide these menu items for only but a few specified admin users:
 * ![](https://i0.wp.com/i.postimg.cc/4dsJzPmT/Capture.png?ssl=1)
 * I’ve tried fiddling around with `remove_menu_page()` and `remove_submenu_page()`
   in my theme’s functions.php but neither method seems to work.
 *     ```
       function CustomDashboard_menus () {
          // if userID isn't 2 and 438, hide these menu items
           $allowed_ids = array(2,438);
           if(!in_array(get_current_user_id(), $allowed_ids)) {
   
             // PARTICIPANTS DATABASE
             // remove_menu_page( 'participants-database' );
               // List Participants
               // Add Participant
               // Manage Database Fields
                 remove_menu_page( 'participants-database-manage_fields' );
               // Manage List Columns
                 remove_menu_page( 'participants-database-manage_list_columns' );
               // Import CSV File
                 remove_menu_page( 'participants-database-upload_csv' );
               // Settings
                 remove_menu_page( 'participants-database_settings_page' );
               // Setup Guide
                 remove_menu_page( 'participants-database-setup_guide' );
           }
       }
       add_action( 'admin_menu', 'CustomDashboard_menus', 999 );`
       ```
   
    -  This topic was modified 4 years, 6 months ago by [Trippetchz](https://wordpress.org/support/users/trippetchz/).
    -  This topic was modified 4 years, 6 months ago by [Trippetchz](https://wordpress.org/support/users/trippetchz/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/hiding-menu-items-3/#post-15308339)
 * Yes, you probably won’t be able to do it like that, the timing has to be just
   right.
 * Have you tried giving those users a custom role? that is the easiest way to control
   access. Once you have your custom roles set up, you can select the custom role
   in the Plugin settings under the Admin tab. There is a secondary plugin role (
   Record Editor) you can use to give people limited access to plugin menu items
   and functionality.
 * The plugin does have filters built into it to control who has access to various
   menu items if you want to to it with custom code.
 *  Thread Starter [Trippetchz](https://wordpress.org/support/users/trippetchz/)
 * (@trippetchz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/hiding-menu-items-3/#post-15325775)
 * Hi there,
 * Thanks for getting back.
 * Yes, I’d prefer the latter as I’d like to check using an array of WordPress User
   IDs as opposed to custom roles, etc.
 * Which filters can I use, since the common method above isn’t working?
 * Thanks,
    T

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hiding menu items’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Trippetchz](https://wordpress.org/support/users/trippetchz/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/hiding-menu-items-3/#post-15325775)
 * Status: not resolved