Support

Account

Home Forums ACF PRO Opinion: Register fields via PHP or Local JSON? Reply To: Opinion: Register fields via PHP or Local JSON?

  • ACF field groups in the DB create additional queries that need to be performed, slowest as far as performance goes.

    ACF fields in JSON files, for example in an acf-json folder, are loaded first. Reading these files from the folder is significantly faster than loading from the DB. This is why Elliot has added this feature. ACF still needs to do a query to get any groups not loaded this way, or to check to see if each group has already been loaded from JSON. The improved performance comes from not needed to do a query to get all the fields in each group.

    You can create field groups in PHP in one of two ways.

    1) You can read your own JSON files or set another load point for ACF. This is not really different than having them in an acf-json folder in the theme.

    2) You can code them right in PHP, like I said, I usually do this when I’m not going to use the field group “as is” and I might want to alter it is some other way. I don’t know if there is much improvement here. You’re reading one less file, so I’d assume there is, but my guess is that any improvement is insignificant.