Support

Account

Home Forums ACF PRO Including ACF in a Plugin… caveats?? Reply To: Including ACF in a Plugin… caveats??

  • If they do not have acf installed, then there shouldn’t be problems

    If the site has ACF installed as a stand alone plugin, then there will likely be problems. If they use the free version then this will definitely cause conflicts. ACF4 and 5 work differently and store data for field groups and field settings in completely different ways. The order that plugins are installed will determine Which one will be used and there isn’t any way to determine the order. Basically, from my experience, plugins are loaded in the order that they were activated, and this order changes every time that a plugin is deactivated and activated again and also changes every time a plugin is updated.

    Basically, you will need to have some type of checking to see what version of ACF is running and if it is not 5 then you’ll, well, I’m not sure. Your plugin will probably not work, or the stand alone ACF4 will not work determined by which is loaded first.

    I know that ACF is built so that you can include it in plugins and themes, but I’ve never been a fan of including other plugins in my plugins and themes because of the many problems that you need to overcome. This is particularly true of extremely popular plugins like ACF. You may want to include something in your documentation that ACF5 is used and required and maybe provide some type of configuration setting, to conditionally load your included version or the stand alone installed separately.

    You might also create a “plugins_loaded” action that only loads the version in your plugin if ACF is not already active. In the same action you could detect the version of ACF and if it’s not 5 you can automatically deactivate your plugin with some type of error message saying that it was deactivated and that ACF5 is required or something.

    Not sure if any of this will help you.