How to Cache ACF Fields (And Make it Faster)

Instead of saving the Field Groups setting into the database, you can do so in your theme folder.

ACF (Advanced Custom Fields) is a plugin to create user-friendly custom fields. Visit their website to learn more.

Instead of saving the Field Groups setting into the database, you can do so in your theme folder.

I heavily recommend doing this because it improves the loading speed in both front-end and back-end.

1. Create /acf-json Folder in Your Theme

Create /acf-json folder in your theme

2. Done

Seriously?

Yes! now every time you save a Field Group, it will create a JSON file in that folder automatically.

For existing Field Groups, open all one by one and re-save them.

JSON files that are saved automatically

Conclusion

As stated above, you should apply this tip on all your sites that use ACF.

Not only for a performance boost, but it also helps with syncing different installations and version control it with Git.

Note: Sorry for the lack of update, it’s been a busy end of the year 🙂

Default image
Henner Setyono
A web developer who mainly build custom theme for WordPress since 2013. Young enough to never had to deal with using Table as layout.
Leave a Reply

2 Comments

  1. Thanks for this tip! So if I do this, the ACF fields will be cached when updated in the ACF post? (I use WP Fastest cache for caching)

    • Hi Annika, it only cache the field settings, not the value. Normally, ACF need to query the database to see how to format the value. If you use this method, ACF will read this JSON file which is faster