Home › Forums › Add-ons › Options Page › Sub-pages slug
Hi everyone,
I have one issue with sub-pages on options_page.
I tried to add some fields via PHP file. I read the documentation so I think it’s all good but I don’t know how to set the value of location for specific sub_page. I’ve set param to “options_page”, but what else to set sub_page?
My settings for options page is:
if( function_exists(‘acf_add_options_page’) ) {
// main options page
acf_add_options_page(array(
‘page_title’ => ‘Web tools’,
‘menu_title’ => ‘Tools’,
‘menu_slug’ => ‘theme-settings’,
‘capability’ => ‘update_core’,
‘redirect’ => false
));
// sub options page for header of the page
acf_add_options_sub_page(array(
‘page_title’ => ‘Header tools’,
‘menu_title’ => ‘Header’,
‘parent’ => ‘theme-settings’
));
}
And this is my settings for location of specific field_group:
‘location’ => array (
array (
array (
‘param’ => ‘options_page’,
‘operator’ => ‘==’,
‘value’ => ‘theme-settings’,
),
),
),
But how specify value of specific sub_page?
Thanks for every response.

The first thing you want to to is alter the setting for the sub options page
// sub options page for header of the page
acf_add_options_sub_page(
array(
'page_title' => 'Header tools',
'menu_title' => 'Header',
'parent_slug' => 'theme-settings',
'menu_slug' => 'header-tools'
)
);
The location rule is the menu slug. Or you could go into ACF and click on add field group and then examine the select field to find out what the current value that’s being used is.
Hi,
thank you a lot for advise. I tried ‘menu_slug’ but it seemed dysfunctional. After a few attempts works fine.
The topic ‘Sub-pages slug’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.