Skip to main content
How to Cache ACF Fields?

How to Cache ACF Fields?

AuthorWebtech Nepal Team
Publish DateOctober 14, 2022
1. Create a folder named as acf-json in your main theme folder

ACF (Advanced Custom Fields) is a plugin to create user-friendly custom fields and make website fields rapidly without touching the database. Visit their website to learn more.

Cacheable fields save ACF field group and field attributes as JSON files with a file name like group_6335ad67c484f.json within your theme folder. Now that the JSON file exists, ACF will load the relevant field group and field attributes from this file which reduces the number of database calls during your page load. It also improves the loading speed in both the front-end and back-end.

1. Create a folder named as acf-json in your main theme folder

When you create a folder called acf-json now, every time you save a field group and field attributes, it will create a JSON file in that folder automatically. For existing Field Groups, open all one by one and re-save them.

2. Sync Changes

Automation process will be apply for sync changes of the field group and field attributes.

3. Security

If you wish to hide your field group or field attributes from the public, simply add an empty index.php file to your acf-json folder.

theme-folder/acf-json/index.php

<?php

// Silence is golden.

?>

4. Conclusion

You can apply this tips on all your websites that use ACF Plugin.

Ready to build

something great?

Tell us about your project and get a free, no-obligation quote within 24 hours. No pushy sales calls, just honest advice.