Tagged: 

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #172995 Reply
    Saurab Gupta
    Guest

    Issue Summary:

    When wp_cache_set() is triggered from the WordPress admin panel (wp-admin), W3 Total Cache disables object cache storage due to the following condition inside _check_can_cache_runtime():

    if (
    $this->_caching
    && defined( ‘WP_ADMIN’ )
    && ( ! defined( ‘DOING_AJAX’ ) || ! DOING_AJAX )
    ) {
    $this->_can_cache_dynamic = false;
    $this->cache_reject_reason = ‘WP_ADMIN defined’;

    return $this->_can_cache_dynamic;
    }

    Configuration Details:

    In the W3TC Dashboard:

    Performance → Object Cache → Advanced (/wp-admin/admin.php?page=w3tc_objectcache)

    the option: Enable caching for wp-admin requests is currently disabled.

    Problem:

    Because of this configuration and the above condition, object cache operations are skipped for all non-AJAX wp-admin requests.

    As a result, when settings are updated from the admin panel and wp_cache_set() is called during the save process, the cache is not refreshed/updated in Redis/Memcached/object cache storage.

    This leads to stale data being served on the frontend.

    Example Scenario:

    User updates General Settings from WordPress admin
    wp_cache_set() is executed during settings save
    Since request originates from wp-admin, _check_can_cache_runtime() returns false
    Object cache update is skipped
    Frontend continues showing old cached values until cache expiry/manual purge

Viewing 1 post (of 1 total)
Reply To: W3TC Object Cache Disabled for wp-admin Requests Causes Stale Frontend Data
Your information: