I am trying to set up Options Page with Advanced Custom Fields in WP.
What I have in functions.php
file :
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
acf_add_options_sub_page('General');
acf_add_options_sub_page('Header');
acf_add_options_sub_page('Footer');
}
The problem is that function_exists('acf_add_options_page')
returns false
.
Seems like that function does not exist, however I am using the latest version of ACF.
When I try to use acf_add_options_page();
:
I get the following Uncaught Error: Call to undefined function acf_add_options_page()
When I avoid using acf_add_options_page();
, using only acf_add_options_sub_page()
:
I get the following Warning(s)
Warning: Illegal string offset 'slug' in C:\xampp\htdocs\wp-content\plugins\acf-options-page\acf-options-page.php on line 230
Warning: Illegal string offset 'title' in C:\xampp\htdocs\wp-content\plugins\acf-options-page\acf-options-page.php on line 230
p.s. I am using an hook (tried with init, plugins_loaded and admin_init) on functions.php
to load the functions :
add_action('init', 'my_init_function');
function my_init_function() {
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
acf_add_options_sub_page('General');
acf_add_options_sub_page('Header');
acf_add_options_sub_page('Footer');
}
}