Support

Account

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.