Home Forums ACF PRO ACF Performance


ACF Performance

  • Hi everyone,

    So one of my websites – – is pretty DB intensive. Certain pages are always going to be DB intensive because of what it’s doing, but I’m trying to explore ways that I can reduce them.

    So I’m just wanting some clarification on things:

    1. acf-json

    Locally, I’ve looked at possible query reductions by using acf-json, and it does reduce them slightly. But my issue is getting it working on staging/live environments.

    All my WP websites are version controlled, based on WP Deploy. The issue is that because of how deploying works, having acf-json inside the theme would mean it’d be wiped clean with every commit (I’d need to jump through and re-save ACF groups).

    Instead, I’d want acf-json to be sat in my shared folder; which goes untouched by commits/deploys (it’s where uploads sit). I know that ACF allows you to declare a custom location/folder to check for .json files, but I’m asking: Can ACF look outside of the theme?

    2. get_fields()

    Is there any performance saving with using get_fields() over individually getting custom fields with get_field()?

    This website literally trawls through 1000+ posts (aka. ‘events’) so even 1 query per event would help a lot.

  • Hi @jasonthecodezombie-co-uk

    Yes, you can store it somewhere outside of the theme. Here’s an example how to set it in the uploads folder:

    add_filter('acf/settings/save_json', 'my_acf_json_save_point');
    function my_acf_json_save_point( $path ) {
        // update path
        $upload_path = wp_upload_dir();
        $path = $upload_path['basedir'] . '/my-custom-folder';
        // return
        return $path;

    I believe there are no distinct differences between those functions. You can check it yourself by using a query monitoring plugin like this one:

    If your site is query intensive, I suggest you use a cache plugin instead.

    I hope this helps 🙂

  • Thanks James,

    That’s what I tried, but it didn’t seem to want to generate the .json files when I saved the ACF groups. I’ll give it another [proper] try and see how I get on (I came to ACF forums to make sure I wasn’t chasing a dead end).

    My work’s developed our own developer suite and it includes DB query counts, so I’ve been using that to see if there’s any difference; there doesn’t seem to be.

    Yep, caching’s my next route now, just thought I’d dig into the code and see if I could alleviate some of the load!

  • Hi @jasonthecodezombie-co-uk

    That’s weird. I’ve tried that code and it was working great. Please make sure that your server has the permission to write to the selected folder.

    Thanks 🙂

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

The topic ‘ACF Performance’ is closed to new replies.