Home Forums Bug Reports Fatal Error 4.3.0 acf_field not found


Fatal Error 4.3.0 acf_field not found

    • miniMAC

    • November 6, 2013 at 8:37 pm

    Hello Elliot,

    i’ve made a theme for WordPress and i have included the plugin and all addon-ons. All work fine since version 4.2.2

    I get this error on version ACF 4.3.0:
    Fatal error: Class 'acf_field' not found in …/acf-gallery/gallery.php on line 4

    After a little search in the new ACF 4.3.0 i found the problem in acf.php:

    add_action('plugins_loaded', array($this, 'include_before_theme'), 1);

    If i change to this:
    add_action('after_setup_theme', array($this, 'include_before_theme'), 1);

    All work fine but add ons and options disappears, and the exported php not work

  • Hello @minimac, Elliot

    I have a similar problem on my website. I export all acf fields but i require_once in my plugins and there not appears. What’s your recommandation to require fields ?

    Which hook should I calibrate? ‘init’ ?


    • miniMAC

    • November 6, 2013 at 10:42 pm

    Ok, i found the solution. (but an UGLY solution, @elliot surely will do it better)

    // includes
    //add_action('plugins_loaded', array($this, 'include_before_theme'), 1);
    add_action('after_setup_theme', array($this, 'include_after_theme'), 1);

    just disabled plugins_loaded

  • I don’t think this is the good solution. This hook was introduced in 4.3.0

  • @minimac How do you include your acf files with register_field_group ?
    Which hook do you use ?

  • I was having issues with “the_field” giving fatal errors, not sure if it is related. I ended up using an if statement to prevent the call from happening if the_field was undefined (which is probably a good thing anyway)… not sure if its related…

  • My solution was to register all my fields on INIT hook 😉 or plugins loaded but with priority to 20 because ACF was placed on 1

    • Elliot

    • November 8, 2013 at 5:47 pm

    Hi @minimac

    Looks like the issue is caused when ACF is included in a theme rather than included in the plugin.

    This causes some of the core files to not be included and causes the error.

    I’ll do some work on this and report back soon.


    • Elliot

    • November 8, 2013 at 5:56 pm

    Hi guys

    I just posted a temp fix on a similar thread:

    • miniMAC

    • November 8, 2013 at 5:58 pm

    Thanks @elliot

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.