Home Forums Add-ons Options Page How to hide "Options Page" menu item for specific users


How to hide "Options Page" menu item for specific users

  • Is there a way to hide the “Options Page” menu item for specific users? I’d like to only have options available for Administrators.

    I’ve tried using something along the lines of this (which didn’t work):


  • I ran into the same problem and while debug stepping through how the options page menu item is registered and named I discovered it’s not admin.php?etc. but rather just ‘acf-options’. This works for me:

    add_action('admin_init', 'remove_acf_options_page', 99);
    function remove_acf_options_page() {
  • Ah that’s perfect. Thank you for sharing!

    It also works when you try to re-order the menu too.

    function custom_menu_order($menu_ord) {
    	if (!$menu_ord) return true;
    	return array(
    		'index.php', // Dashboard
    		'separator1', // First separator
    		'edit.php?post_type=page', // Pages		
    		'edit.php', // Posts		
    		'upload.php', // Media
    		'acf-options', // ACF Options
    		'separator2', // Second separator
    		'users.php', // Users
    add_filter('custom_menu_order', 'custom_menu_order');
    add_filter('menu_order', 'custom_menu_order');
  • I’ve been trying this for about an hour now with no success.

    I’m trying to remove the ACF generated “Options” menu from my Dashboard and all subsequent submenus.

    I have tried using the above code provided:

    add_action( 'admin_init', 'hide_acf_options_menu', 99 );
    function hide_acf_options_menu(){

    As well as a few variations that include using the hook “admin_menu”, trying out variations on the menu slug based on a print_r:

    Array ( [title] => Course Settings [menu] => Options [slug] => acf-options-course-settings [capability] => edit_posts [pages] => Array ( [0] => Array ( [title] => Course Settings [menu] => Course Settings [slug] => acf-options-course-settings [parent] => acf-options-course-settings [capability] => edit_posts ) [1] => Array ( [title] => Appearance Settings [menu] => Appearance Settings [slug] => acf-options-appearance-settings [parent] => acf-options-course-settings [capability] => edit_posts ) [2] => Array ( [title] => Certificate Settings [menu] => Certificate Settings [slug] => acf-options-certificate-settings [parent] => acf-options-course-settings [capability] => edit_posts ) ) [show_parent] => 1 )

    acf-options-course-settings would seem to be the magic menu slug, but nothing is getting rid of this Options menu. Any advice, suggestions, or request for further information would be more than welcome.

  • Hi @matthewheck

    Have you tried remove_menu_page('acf-options-course-settings'); ?

  • That code didn’t solve my problem. My options are still visible and I have do hide them for people who aren’t admins. Someone wanna help? All stuff above doesn’t work for me.

  • Didn’t realize had already been solved and one year old. Oops..

    Try this… not my code, but should remove menu items for everyone except admin (goes in functions.php):

    function remove_menus()
        global $menu;
        global $current_user;
        if($current_user->user_login != 'admin')
            $restricted = array(__('Posts'),
            end ($menu);
            while (prev($menu)){
                $value = explode(' ',$menu[key($menu)][0]);
                if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
            }// end while
        }// end if
    add_action('admin_menu', 'remove_menus');
  • Hi everyone,

    Since “Options page” v1.1 you can use in your function.php :

    acf_set_options_page_capability( 'edit_themes' );
    where ‘edit_themes’ is a typical wordpress admin capability

    > “Options page” v1.1 release note and example here

    Or since “Options page” v1.2, you can setup capability in your function.php like this :

    function my_acf_options_page_settings( $acf_options_page_settings )
      $acf_options_page_settings['title'] = 'Theme Options';
      $acf_options_page_settings['pages'] = array('Sub-page 1', 'Sub-page 2');
      $acf_options_page_settings['capability'] = 'edit_themes';
      return $acf_options_page_settings;
    add_filter('acf/options_page/settings', 'my_acf_options_page_settings');

    Check the line : $acf_options_page_settings[‘capability’] = ‘edit_themes’;

    Hope you enjoy 😉

  • None of these work for me. ACF 5.

  • Okay this works, just adding “capability” ( to the sub-pages.

    	'page_title' 	=> 'Colors',
    	'menu_title'	=> 'Colors',
    	'parent_slug'	=> 'theme-general-settings',
    	'capability'	=> 'manage_options',

    Aaah, and 'position' => 2, works, too 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘How to hide "Options Page" menu item for specific users’ is closed to new replies.