WordPress can execute wp-content/object-cache.php before ordinary plugins load, but Redis and managed hosts also use it legitimately. Preserve the file, identify its owner, compare the exact release, and confirm backend scope before deleting it or clearing Redis.
I’m Ryohei Yokoyama, founder of SiteFixNow. With over 20 years of IT engineering experience and practical WordPress recovery and malware cleanup work, I focus on proving what owns an early-loading file before changing it.
- Why object-cache.php is different from an ordinary plugin file.
- How to preserve and compare the drop-in safely.
- Why a Redis flush is not malware removal.
- How to restore the correct owner and verify recovery.
WordPress object-cache.php Is Executable Drop-In Code
Do not label object-cache.php as malware from its name alone; WordPress intentionally loads this drop-in when it exists.
WordPress checks WP_CONTENT_DIR . '/object-cache.php' while starting the object cache. If the expected cache functions appear, WordPress can treat an external object cache as active. Deactivating every ordinary plugin therefore does not necessarily stop this file from loading.
Obfuscated strings, remote requests, dynamic execution, unrelated redirects, or account-changing code are warning signs. Compare the whole file with the exact trusted package rather than judging one fragment. For suspicious cached pages and CDN output, also follow the broader WordPress cache malware investigation.
Preserve object-cache.php Evidence Before Deleting or Flushing Anything
Record the file and active cache arrangement before cleanup changes the timeline.
Use a trusted hosting shell or a clean administrative device. Loading a compromised WordPress installation can execute the suspect drop-in, so begin with filesystem evidence when server integrity is uncertain. Coordinate with the host if the hosting account may also be compromised.
Record the installation path, owner, permissions, size, modification time, and SHA-256 hash. Copy the file with metadata into a protected incident directory outside the web root. A hash proves whether the file later changed; it does not prove that the original was safe.
Preserve the relevant plugin directory, redacted configuration, deployment history, and server logs. If core bootstrap files changed too, use the separate wp-load.php verification workflow. Do not make one drop-in explain unrelated modifications without evidence.
cd /srv/example/public
stat wp-content/object-cache.php
shasum -a 256 wp-content/object-cache.php
cp -p wp-content/object-cache.php /srv/incident-evidence/object-cache.php.suspectVerify the Drop-In Owner Against the Exact Trusted Release
Identify the plugin, host component, or deployment artifact that should own object-cache.php.
Obtain the same release from the vendor, WordPress.org, the host image, or your organization’s repository. Compare the suspect file with that release. A checksum mismatch requires explanation because hosts may patch a drop-in, but an unrelated payload or unknown recreation process is strong evidence.
Plugin checksum tools may not cover wp-content/object-cache.php because it is outside the plugin directory. If the owner package is modified, use the infected plugin folder cleanup process and replace the complete package instead of editing isolated lines.

shasum -a 256 object-cache.php.suspect object-cache.php.trusted
diff -u object-cache.php.trusted object-cache.php.suspectCheck Redis and Cache Configuration Without Exposing Secrets
Confirm the intended backend, namespace, and shared consumers before any flush.
A wrong Redis database or prefix can cross site boundaries. A shared service also makes a broad flush dangerous because unrelated applications may use the same database. Ask the owner which site, namespace, or database the supported maintenance action will affect.
Review WP_CACHE separately: the constant alone does not create a modern persistent object cache. If configuration contains unknown includes or injected PHP, use the wp-config.php hack cleanup guide and restore it from an approved source.
grep -nE "WP_REDIS_(HOST|PORT|DATABASE|PREFIX|DISABLED)" wp-config.phpClear Redis Only After the Malicious Writer Is Contained
A cache flush removes cached values, not malicious PHP or the process rewriting the drop-in.
Use the cache product’s documented command or hosting control. Confirm whether it clears one prefix, one Redis database, or the entire service, and coordinate the impact. Even wp cache flush delegates to the active implementation, so its practical scope depends on that backend.
Afterward, request known pages and administrative screens and confirm clean regeneration. If the file or symptom returns, stop repeating the flush and follow the WordPress reinfection root-cause workflow to identify the task, account, extension, or server process responsible.
- The product that owns object-cache.php.
- The affected site, Redis database, prefix, and shared consumers.
- The trusted replacement and rollback path.
- The malicious writer or entry point is contained.
Restore object-cache.php and Prove the Site Uses the Trusted Copy
Restore through the legitimate owner, then verify integrity, behavior, and recurrence.
Prefer the owner plugin’s enable or update action, the host’s repair control, or your deployment pipeline. This preserves the expected version and permissions. If temporary removal is necessary, use a reversible rename and confirm fallback behavior before normal traffic resumes.
Hash the deployed file and compare it with the approved artifact. Test public pages, login, editing, and critical transactions; review fresh PHP and Redis errors; then monitor owner, timestamp, and hash through normal cache cycles. An unexplained replacement means recovery is incomplete.
WordPress object-cache.php Malware: Frequently Asked Questions
The drop-in, persistent cache, and malware entry point are related but separate investigation targets.
WordPress object-cache.php Malware Requires Verification Before Cleanup
Preserve the file, identify its owner, compare the exact release, verify scope, contain the writer, restore, and monitor.
Deleting object-cache.php or emptying Redis may change a symptom, but neither proves the site is clean. Recovery must connect evidence, an approved artifact, cache configuration, root-cause repair, and monitoring. If that chain cannot be established safely, pause destructive changes and ask a WordPress security specialist to assess the environment.
If You Can’t Secure or Recover Your WordPress Site Yourself
Ask for help when ownership, cache scope, or the process recreating the drop-in cannot be verified safely.

If your website shows malware warnings, redirects to strange pages, or you are not sure whether it is secure,
SiteFixNow can help clean, repair, and recover your WordPress site.
- Your WordPress site may be infected with malware.
- Security warnings appear in Google or browser results.
- You found unknown admin users or suspicious files.
- The site redirects to spam or unknown websites.
- You need urgent WordPress hacked site repair.
- Reduce visitor risk and SEO damage.
- Find hidden malware and backdoors, not only visible symptoms.
- Recover the site safely without unnecessary data loss.
