Home Forums Bug Reports Issues with object-cache.php


Issues with object-cache.php

  • I have spotted a number of issues with the current version (5.6.2) of ACF when object-cache is enable. Object caching officially supported by core and many sites, including use it to scale. However it appears that this plugin has not been tested using object-caching enabled.

    First issue, that none of the fields register in the admin terminal. See screenshot. I got the following error.

    Warning: Invalid argument supplied for foreach() in /app/web/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field-group.php on line 199
    Call Stack:
        0.0028     432776   1. {main}() /app/web/wp-admin/post.php:0
        5.0263   32297272   2. include('/app/web/wp-admin/edit-form-advanced.php') /app/web/wp-admin/post.php:173
        5.0554   32421216   3. require_once('/app/web/wp-admin/admin-header.php') /app/web/wp-admin/edit-form-advanced.php:472
        5.0842   32620536   4. do_action() /app/web/wp-admin/admin-header.php:142
        5.0842   32620912   5. WP_Hook->do_action() /app/web/wp-includes/plugin.php:453
        5.0842   32620912   6. WP_Hook->apply_filters() /app/web/wp-includes/class-wp-hook.php:323
        5.0897   32622432   7. acf_input->admin_head() /app/web/wp-includes/class-wp-hook.php:298
        5.0897   32622432   8. do_action() /app/web/wp-content/plugins/advanced-custom-fields-pro/includes/input.php:216
        5.0897   32622808   9. WP_Hook->do_action() /app/web/wp-includes/plugin.php:453
        5.0897   32622808  10. WP_Hook->apply_filters() /app/web/wp-includes/class-wp-hook.php:323
        5.0897   32623936  11. acf_form_post->admin_head() /app/web/wp-includes/class-wp-hook.php:298
        5.0897   32623936  12. acf_get_field_groups() /app/web/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-post.php:166

    This is because when object caching is enable, the wp_get_cache returns value by default. You want to change it the following lines.

    in api/api-field-group.php


    if( acf_isset_cache($cache_key) ) {
    		$post_ids = acf_get_cache($cache_key);
    	// query DB for child ids


    if( acf_isset_cache($cache_key) && acf_get_cache($cache_key)) {
    		$post_ids = acf_get_cache($cache_key);
    	// query DB for child ids

    There is a similar issue with the text field as well, that returns false. in fields/text.php I added the following lines to fix the issue.
    Line 113

       if ( $atts['value'] === false ) {
           $atts['value'] = "";
  • Please submit bug reports of this nature by opening a new support ticket here

  • What’s the official status on object-cache with ACF? I see treads dating back from 2012 people systematically asking for embracing the feature. it seems like it was implemented at some point but never really working properly.

    Was this OP issue ever fixed, what’s the general status?
    I’d love to be able to use WP-Redis.

  • I too am seeing this problem when I have an object cache turned on. @spaced_monkey’s code suggestion removes the issue.

    Any word on whether / when a fix for this will be sorted please?

  • Hi guys

    Object caching is definitely something that got forgotten about in the last few years, my bad.

    I’m currently wrapping up work on version 5.7, and think this is a good time to focus on caching. The first step is for me to replicate the issue. Can someone provide some simple info about setting up caching on a local site?

    Is it as simple as installing a plugin? Or do I need to configure settings in my local environment. For reference, I use a combination of MampPRO and Local by flywheel for local testing.

  • I thought, but not certain as I don’t use MAMP Pro anymore that it was a setting you could choose to switch on, just like you can switch between different PHP versions.

  • Hi @wpmark

    Thanks for the reply.
    I’m not seeing any obvious settings in MAMP PRO. I’ll jump online and find some tutorials for setting up local object caching. If you know of any good ones, please let me know.

  • I’m curious if information from this site has helped anyone with Object Cache and ACF?

    From their site:


    The Advanced Custom Fields plugin disables persistent caching, as shown in the following function on line 30…


    While using an Object Cache boosts performance for your site, using this plugin with it enabled can cause inconsistencies and unexpected behavior. See more information about this issue here.

    If not using the plugin isn’t an option you can attempt to use the redis-cache plugin workaround.

  • Is there any updates on this issue? Our site is with SiteGround and we are getting Warnings about ACF still.

  • @pasadenaweb Thanks for the question. Unfortunately, I have not made any progress with this as all my attention is dedicated to Gutenberg issues at the moment.
    Thanks for your understanding.

  • @elliot I am upset that this hasn’t been handled in over a year. Specially since, I have already done the hard work and even you the exact code you have to change. I am also sad to find that github has not been updated. The version on github is 4.4.2 (

    Object caching is not an adanced feature anymore. WP Engire, site ground and VIP GO all have object caching out of the box. This means you plugin is broken for some of the biggest hosts in the world for the highest traffic-ed sites.

    I know that you business is in pro version, but I would love it if you follow model similar to yoast, where you have the free version of github, taking feedback and patch from the community and keep pro version paid for in another repo.

    I am on twitter and wordpress slack, just search spacedmonkey and you should find me if you wish to discuss the patch.

  • Hi @spaced_monkey

    Thanks for the reply, and for calling me out on this.

    I agree with you, and am also frustrated that I haven’t solved this yet.
    The good news is that I have been collecting information from a few support tickets on this same subject and have plans to fix this as soon as possible.

    This year has been a big one, and I haven’t been able to tick off all the to-do’s on my list. This issue effects both the free and PRO users, so please don’t think this has anything to do with finances.

    Right now, I am dedicating all my time to Gutenberg related work and trying my hardest in all areas to make sure that WordPress continues to function as a flexible and reliable CMS.

    The issue itself is quite simple. I had made use of the $found parameter in wp_cache_get() as per the documentation (, but it turns out that some object caching does not respect/modify this parameter.

    I’m happy to simplify my code and will do so after the Guten-dust settles.
    Your help is and will be greatly appreciated. If not already, can you please open up a support ticket here ( and ask for me personally (Elliot) to discuss this object caching issue with? This community forum is a great way for devs to communicate, but is not my primary area to work on bugs.


  • Hi @elliot!

    I know you have been deep in Gutenberg over the past couple of months. Any updates on the object cache discussion?


  • @palmerijosh

    Great timing. I’m currently wrapping up testing on version 5.7.11 which aims to fix these caching issue!

    Can you please checkout the 5.7.11 announcement and test out the beta if possible?

  • Thanks @elliot! Checking this out now.

  • @elliot Thanks for the most recent update to 5.7.11 beta. I am looking at a significant set of nested repeater fields that I am testing for performance improvement with the updated object caching. I am not seeing a whole lot of improvement. I have the edit screen in WP down to 93 Queries, 31 of them being called by ACF Pro. The frontend takes quite a while to load (~11 seconds) and about 70 requests are being made to ajax-request.php. Let me know if you have any ideas on how to improve performance, and if this is the best channel to discuss. Thanks.

  • @palmerijosh Thanks for the reply.

    I’m confident that our object caching is working well in 5.7.12, so I suspect there is something else at play.

    I’m happy to take a look at your site and help debug the issue. Can you please open a support ticket via the following link and ask for me (Elliot):

    It would be great to get access to your site (or a staging site) so I can login and test the object caching / SQL queries.

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

The topic ‘Issues with object-cache.php’ is closed to new replies.