When I talk about “when” things happen it has to do with the order of hooks in WP and very little to do with the order of code.
For example if you have these two filters added
add_action('init', 'my_init_function'); add_action('after_setup_theme', 'my_after_setup_theme_function');
the function on the hook ‘after_setup_theme’ will always run before the function on the ‘init’ hook no matter what the priority is or what order these functions appear in the code.
Here is the list of WP hooks and the order that they run https://codex.wordpress.org/Plugin_API/Action_Reference
When I say that ACF might be prematurely initialized what I am looking for is any call to any ACF funtion that happens before the hook “after_theme_setup”. Filters and actions added in your functions.php file are not added until after this hook. This means that if something has initialized ACF before this time then you file and filters are loaded after
acf/settings/load_json is run.
things like this are usually caused by plugins because they are loaded before the theme files.
If it does have something to do with
add_action('admin_bar_menu', 'custom_toolbar_link', 999); then it would be in the code of the action function, not the adding of the action.
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!
© 2022 Advanced Custom Fields.