Home › Forums › Backend Issues (wp-admin) › All custom fields showing in all post types regardless of Location rules › Reply To: All custom fields showing in all post types regardless of Location rules
thanks to another user on this forum, I realised that I’d caused this issue by loading all scripts including jQuery with the ‘defer’ tag.
the code, which filters all enqueued scripts now looks like this:
function add_async_attribute($tag, $handle) {
if (!is_admin()) return str_replace( ' src', ' defer="defer" src', $tag );
return $tag;
}
add_filter('script_loader_tag', 'add_async_attribute', 10, 2);
i.e. it’s turned off for admin pages, so that scripts load before inline ACF code is executed.
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.