Support » Plugin: Advanced Custom Fields: Font Awesome Field » Unable to use ACFFA_always_enqueue_fa filter

  • Hello,

    I’m hooking into this filter in my functions.php file like so:

    add_filter('ACFFA_always_enqueue_fa', '__return_true');

    However, it still returns false in the plugin, seemingly because that filter is processed before functions.php has been loaded by WordPress.

    I think this is a bug. Can you please confirm or set me straight?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    I think you might be right. I’ve had to tweak when things in the plugin init themselves over the years to stay compatible with ACF and other ACF addons and this may have been a casualty of one of those updates. Currently this plugin registers itself on the ACF ‘acf/include_field_types’ action hook, and the ‘ACFFA_always_enqueue_fa’ hook from this plugin fires pretty much right away from there.

    I don’t think I will be able to change the ordering of this to work with a hook in functions.php without breaking something else. The way forward might be a constant like the ‘ACFFA_OVERRIDE_MAJOR_VERSION’ that I use in other areas (because of this same kind of timing issue). In the meantime you may be able to define your action in a plugin as a workaround depending on your situation and if that makes sense for you.

    Thanks for bringing it to my attention.

    Plugin Author Matt Keys

    (@mattkeys)

    Something just came to mind that may be relevant in your case. I feel like I remember that the exact timing of when the ‘acf/include_field_types’ hook fires can actually change to fire sooner if a call is made to an ACF get_field function. If you have calls like that in your functions.php, you might try moving the ACFFA_always_enqueue_fa filter to be at the top before any other ACF calls happen.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.