Support

Account

Home Forums ACF PRO Multiple subpages for Options page

Solved

Multiple subpages for Options page

  • Hi

    I’m trying to create multiple subpages for my Options page, but even though they appear as menu sub items, the url is not correct.

    The first sub menu item, gets an correct url like /wp-admin/admin.php?page=acf-options-din-aftale

    But the following sub menu items, gets urls like wp-admin/acf-options-reklamer

    which of course gives me an 404 error.

    My code

    if( function_exists('acf_add_options_sub_page') )
    {
        acf_add_options_sub_page(array(
            'title' => 'Din aftale'
        ));
        acf_add_options_sub_page(array(
            'title' => 'Reklamer'
        ));
        acf_add_options_sub_page(array(
            'title' => 'Footer'
        ));
    }
    
    acf_add_options_page();
  • Have you tried to set the parent?
    Set up the menu slug for the main page

    if( function_exists('acf_add_options_page') ) {
    	$page = acf_add_options_page(array(
    		'page_title' 	=> 'My Options Page',
    		'menu_title' 	=> 'My Options Page',
    		'menu_slug' 	=> 'options-settings',
    		'capability' 	=> 'edit_posts',
    		'redirect' 	=> false
    	));
    }

    and then add it as a parent

    if( function_exists('acf_add_options_sub_page') ){
    	acf_add_options_sub_page(array(
    		'title' => 'Din aftale',
    		'parent' => 'options-settings'
    	));
    
    	acf_add_options_sub_page(array(
    		'title' => 'Reklamer',
    		'parent' => 'options-settings'
    	));
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.