Support

Account

Home Forums Add-ons Options Page Hide Options Parent Page

Solved

Hide Options Parent Page

  • Hello, I am setting up an ACF Pro Options page for the first time and have a question.
    My Options pages have this hierarchy:

    Edit Content (parent)
    – Header (child)
    – Footer (child)

    In the WP Admin Menu, the menu item for these options is called ‘Edit Content’. When you hover over the ‘Edit Content’ menu item, you see a dropdown with three pages: Edit Content, Header, and Footer.

    How do I hide the ‘Edit Content’ parent page, so that only ‘Header’ and ‘Footer’ show up when you hover over the ‘Edit Content’ item in the main menu sidebar?

    acf-options

    Here’s the code I’m using:

    if( function_exists('acf_add_options_page') ) {
    	
    	acf_add_options_page(array(
    		'page_title' 	=> 'Content Settings',
    		'menu_title'	=> 'Edit Content',
    		'menu_slug' 	=> 'content-settings',
    		'capability'	=> 'edit_posts',
    		'redirect'		=> false,
    		'icon_url'		=> 'dashicons-edit',
    	));
    	
    	acf_add_options_sub_page(array(
    		'page_title' 	=> 'Theme Header Settings',
    		'menu_title'	=> 'Header',
    		'parent_slug'	=> 'content-settings',
    	));
    	
    	acf_add_options_sub_page(array(
    		'page_title' 	=> 'Theme Footer Settings',
    		'menu_title'	=> 'Footer',
    		'parent_slug'	=> 'content-settings',
    	));
    	
    }
  • change “redirect” on the parent page to true

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.