Home › Forums › ACF PRO › Can't Register Options Page from Plugin › Reply To: Can't Register Options Page from Plugin
I know that you marked this as a solution, but I wanted to post this for others that find it. You can’t be sure of the order that plugins are loaded unless you activate them in a specific order. Updating a plugin usually causes it to deactivate and reactivate, changing the order of the array mentioned in the link you gave.
It’s better to run a function on a WP hook, for example
add_action('init', 'my_init_function');
function my_init_function() {
if (function_exists('acf_add_options_page')) {
$page = acf_add_options_page(array(
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
}
}
the plugins_loaded
hook would also work in this case
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.