The fatal error Call to undefined function w3tc_button_link() (or a similar w3tc_ function) appears when W3 Total Cache has been deactivated or deleted but files it added still run. WordPress loads cache drop-ins such as wp-content/advanced-cache.php, object-cache.php and db.php on every request, even with the plugin gone, and those files call W3 Total Cache functions that no longer exist. Remove the leftover files after confirming they belong to W3 Total Cache, and clean up wp-config.php and .htaccess.
Originally published in October 2013. Rewritten in December 2026 with a full cleanup checklist.
Step 1: Get back into the site
If the error takes down the whole site, use FTP, SFTP or your host’s file manager. If you can still reach wp-admin, WordPress’s recovery mode email may also help you get in.
Step 2: Remove the drop-in files
Look in wp-content/ for these files:
advanced-cache.phpobject-cache.phpdb.php
Open each one before deleting it. Files created by W3 Total Cache mention “W3 Total Cache” or W3TC near the top. If a file belongs to another plugin, such as LiteSpeed Cache or Redis Object Cache, leave it alone.
Rename the file first, for example to advanced-cache.php.bak, and check that the site loads. Delete it once you’re sure.
Step 3: Clean up wp-config.php
W3 Total Cache adds this line near the top of wp-config.php:
define('WP_CACHE', true); // Added by W3 Total CacheRemove it if you don’t use another page cache plugin. If you’ve switched to a different cache plugin, it will add its own line when you enable caching.
Step 4: Clean up .htaccess and leftover folders
Remove the blocks between # BEGIN W3TC and # END W3TC markers in .htaccess. Keep a copy of the file first. Then delete these folders if they exist:
wp-content/w3tc-config/wp-content/cache/(only W3 Total Cache’s subfolders if another cache plugin uses this folder)
Step 5: Check the database
W3 Total Cache stores a few options, all starting with w3tc_. They don’t cause errors, but you can remove them with WP-CLI:
wp option list --search='w3tc_*' --field=option_name | xargs -r -n1 wp option deletePrevent it next time
To remove any cache plugin cleanly, first turn off its caching features in its settings, then deactivate it from the Plugins screen, then delete it. This gives the plugin a chance to remove its drop-ins and configuration. Deleting the plugin folder by FTP skips all of that.
If you’re on a LiteSpeed server, as many hosts are, the LiteSpeed Cache plugin usually gives better results than a general-purpose cache plugin. Use only one page cache plugin at a time.
Common questions
Why does the error appear on the Plugins page only?
Some W3 Total Cache code hooks into admin screens. Leftover files load there even when the front end looks fine.
Is it safe to delete advanced-cache.php?
Yes, if it belongs to a cache plugin you’ve removed. WordPress runs fine without it. A cache plugin you install later will create a new one.
The error mentions a different w3tc function. Is the fix the same?
Yes. Any undefined w3tc_ function after removing the plugin points to leftover files.