Skip to content

Drop ins

Shane Rounce edited this page Nov 30, 2026 · 5 revisions

Drop-ins

A drop-in is a file WordPress loads from wp-content before any plugin. Ace Redis Cache has two.

File Loaded What it does
wp-content/object-cache.php On every request, as WordPress starts Replaces WordPress's in-memory object cache with one backed by Redis
wp-content/advanced-cache.php On every request, only when WP_CACHE is true Looks for a stored copy of the page and, with early serve on, answers with it before WordPress loads

The originals live in the plugin at assets/dropins/. The copies in wp-content are what WordPress runs. Both files changed in 0.11.0. Update the pair together if you keep them in version control.

Who writes them

The plugin does, when you save the settings:

Drop-in Installed when Removed when
advanced-cache.php Page Cache is on Page Cache is turned off
object-cache.php Transient Cache is on Transient Cache is turned off

Each file is written to a temporary name and renamed into place, so a request never sees half a file.

What the plugin will not touch

  • A drop-in from something else. If object-cache.php or advanced-cache.php exists and does not carry the Ace Redis Cache name, it is left exactly as it is. Remove the other cache through its own settings first, then save the Ace Redis Cache settings again.
  • Symlinks. A symlinked drop-in is never replaced or removed.
  • Anything that is not a regular file.

When a write fails, for example because wp-content is not writable, an error notice appears in wp-admin and the write is tried again on a later save.

Checking their state

The Caching tab shows each drop-in's state:

State Meaning
Active and up to date Installed, loaded, matches the plugin's copy
Installed and up to date (inactive) Installed but not being used, for example WP_CACHE is off
Active and outdated Loaded, but older than the plugin's copy. Press Update Drop-in.
Foreign drop-in detected The file belongs to something else. The plugin will not overwrite it.

From WP-CLI:

wp aceredis dropin status

Or compare the two copies by hand:

cmp wp-content/object-cache.php wp-content/plugins/ace-redis-cache/assets/dropins/object-cache.php
cmp wp-content/advanced-cache.php wp-content/plugins/ace-redis-cache/assets/dropins/advanced-cache.php

No output means they match.

After a plugin update

On the first request after an update or a deploy, of any kind, the plugin replaces the drop-ins it owns with the new versions. Before 0.10.6 that waited for an administrator to load a wp-admin page. Only files that already exist and already belong to it are replaced: an update never installs a drop-in you had turned off.

Deploys that rebuild wp-content

If each deploy builds a fresh wp-content, the drop-ins must be part of the deploy. The simplest way is one command after the release is in place:

wp aceredis dropin install all

Or commit them to the site repository and update them whenever you update the plugin, or copy them from the plugin as a deploy step:

cp wp-content/plugins/ace-redis-cache/assets/dropins/object-cache.php wp-content/object-cache.php
cp wp-content/plugins/ace-redis-cache/assets/dropins/advanced-cache.php wp-content/advanced-cache.php

An older drop-in beside a newer plugin usually still works, but it is the first thing to check when behaviour does not match this wiki.

Deactivating and deleting

Deactivating the plugin removes object-cache.php and advanced-cache.php from wp-content, but only the copies that carry its own name. On a multisite network they are removed when the plugin is deactivated for the network. Activating again puts them back as your saved settings ask. Deleting the plugin removes them too, if they are still there.

Before 0.10.4 the drop-ins were left behind on deactivation and had to be removed by turning the caches off first, or by hand.

The emergency off switch

define( 'ACEREDIS_DISABLED', true );

With that in wp-config.php both drop-ins stand aside without being removed: object-cache.php hands over to WordPress's own in-memory cache and advanced-cache.php returns at once. The settings screen still loads and says the switch is set.

What the drop-ins read before WordPress has loaded

The drop-ins start before WordPress has read its options, so they take their connection details from wp-config.php:

  • advanced-cache.php uses ACEREDIS_HOST, ACEREDIS_PORT, ACEREDIS_PASSWORD, ACEREDIS_DB and ACEREDIS_SOCKET, or the ACEREDIS_PAGE_* set when pages live on a different Redis. Without them it tries the socket at /var/run/redis/redis.sock, then 127.0.0.1:6379.
  • object-cache.php reads the plugin's saved settings from the database when it can, and falls back to the same constants.

If your Redis is anywhere other than 127.0.0.1:6379 database 0, set the constants. See Constants and filters.

Clone this wiki locally