I am just starting to develop a new plugin, and for some reason ACF isn’t seeing my options page. I have no other plugins activated and my plugin has only this code:
add_action( 'admin_menu', 'mjt_track_settings_page');
function mjt_track_settings_page() {
if( function_exists('acf_add_options_page') ) {
acf_add_options_page( array(
'page_title' => __('Tracker','mjt-track'),
'menu_title' => __('Tracker', 'mjt-track'),
'menu_slug' => 'mjt-track',
'parent_slug' => 'options-general.php',
'capability' => 'manage_options',
'position' => false,
'icon_url' => false,
));
}
}
When I go to ACF and select option page, I see “No options pages exist”.
I have reverted to the previous version to see if that was an issue, however I still get this error.
the admin_menu hook is too late to add the options pages because that’s when acf runs the function that adds the options pages you want.
Change your hook to
add_action( 'init', 'mjt_track_settings_page');
you could also to in to admin_init or as early as plugins_loaded