Loading

post

Uninstall W3 Total Cache – The Proper Way

A few days ago I began the process of removing W3 Total Cache from all my blogs and replacing it with Quick Cache. Why, you might wonder, would I do that. The simple answer is that W3 Total Cache conflicted one too many times with other plugins. I’m getting old and tired and I’m fast coming over to the idea that if a plugin’s too much hassle to setup then it shouldn’t call itself a plugin so much as it should call itself a nail in sanity’s coffin.

You’d expect it to be easy to remove W3 Total Cache. And it should be but it hooks its tentacles into a blog’s htaccess file, sticks multiple files into the blogs wp-content directory and, after removal, Google persistently requests (no longer existent) cached minified CSS files. All in all, it’s a bigger pain than being kicked in the ass by a galloping donkey on steroids.

In general, once setup, W3 Total Cache can be left to cache WordPress blog posts and pages faultlessly without any human monitoring but it gets temperamental when new plugins are installed, especially ones that use Javascript when W3TC is configured to minifi Javascript. If you use W3TC and you find some newly installed plugins fail to work or they bring down your whole site then you can almost guarantee the fault is with W3TC. Ditto if plugins work for logged in users but not for logged out visitors.

Removing W3TC is a bit of an art. For one, you will need to find an adequate replacement for it. I’ve moved over to Quick Cache and I’m quite happy with it. I’ve performed no speed tests and no server load tests to compare it with other cache plugins but I can say that, to me at least, most of the sites I’ve installed it on feel faster and more responsive than when they used W3 Total Cache. Sites hosted on my home server now load instantly with Quick Cache where they took a second or two with W3TC.

Removing the Monster

Important: keep the plugin enabled until told to disable it. If you’ve already disabled and deleted W3 Total Cache then I suggest you re-install it and re-enable it then follow these instructions to properly remove it.

  1. Make sure the latest version of W3 Total Cache is installed
  2. Ensure your htaccess file has its permissions set to at least 644
  3. Ensure wp-config.php has its permissions set to at least 644
  4. Enter W3TC’s General Settings panel (Performance>General Settings)
    • Disable all caching
    • Run through the list of enabled caching types and untick “Enable” for each and every one of them
    • At the bottom of the General Settings page is a Miscellaneous section, untick everything in it
    • Click “Save All Settings”
  5. At the top of the screen, in red writing, you will now see that it says “The plugin is currently disabled”.
  6. Go to your WordPress plugins panel and find W3 Total Cache (Plugins>Installed Plugins)
    • Deactivate W3 Total Cache
    • Delete W3 Total Cache.
  7. Browse your site’s root directory with either an FTP program or your host provided file manager and enter the directory “wp-content” then delete the files (if they exist)
    • w3-total-cache-config.php
    • db.php
    • advanced-cache.php
  8. Still in the wp-content directory, delete the directory “w3tc” and all its content
  9. Check the site’s .htaccess file has no W3TC re-write rules in it
  10. Finally, unless you want to install a new cache plugin, open the site wp-config.php file and change the line that reads
    define('WP_CACHE', true);

    to

    define('WP_CACHE', false);

For security reasons, I would set the file permissions of .htaccess to 444 and wp-config.php to 440. If your server is comfortable with lower values for wp-config.php then set it lower. Try 400,  600, 440 or 640 (the default is 644). The less someone can do with your files, the better your security is. Be aware though, that when either of those files is non-writable by the server, you must temporarily make the server writable when you upgrade WordPress or when you install cache plugins like Quick Cache.

I would love to advise you on which WordPress cache plugin is best but that’s a server and site-by-site dependent issue. What works well for one site on one server will not work well for all sites on the same server or on different servers. Saying that, Quick Cache is pretty good.

Resources & Links

Quick Cache

List of WordPress cache plugins at sixrevisions.com


  • Anonymous

    You should try BWP Minify with Quick Cache. I use it on my blog and it shrinks page sizes and cuts requests as well. http://betterwp.net/wordpress-plugins/bwp-minify/

    • http://journalxtra.com Dion de Ville

      I took a look at it. Thanks for the suggestion but It seems like a lot of work to get a plugin working. Saying that, I didn’t install it, I only looked at the download page.

    • Anonymous

      Actually for 75% effectiveness, just download and activate it. The rest is for tweaking.

  • Sjoerd

    Setting the wp-config.php to 700 made my site + admin go http error 500… Not knowing this was the cause I messed things up even worse… When I finally found out this was the cause (by adding php_flag display_errors on  to the .htaccess file in the root), I was too far gone and had to go reinstall the whole website from scratch……

    But what I don’t understand even now is, why does the wp-config.php needs other permissions than the 644 it has? It’s not like it’s going to be altered when w3tc is being removed.

    • http://journalxtra.com Dion de Ville

      I’m sorry to learn that, Sjoerd, I would have helped you had you told me about it. Different servers are configured slightly differently so some permissions will give 500 errors. I’ll edit the post to prevent others doing the same.

      The reason I suggest changing the permissions of wp-config.php is purely out of security concerns. The file contains a website’s database login details. It’s a prime target for hackers looking for ways into a site. Hiding the file to everybody but the server makes it harder for a hacker to view it or download it.

      I usually use 400 or 440 for wp-config so that either my server is the only user that can view the file or those in the server group can view the file but no one in the world group can view it (people putting example.com/wp-config.php will not see the contents of wp-config.php).

      Some hackers access shared servers through insecure sites hosted on them. Once in, they can edit the wp-config.php file if its permission is set to 6xx. Ensuring it is not writable by the server is a preventative measure against hackers editing the file. Feel free to correct me if I’m wrong.

  • http://spiritualphilosopher.com Kaution60

    Tank you! Great write! I agree :)

  • Pingback: Learn how to improve your WordPress Blog: How I did it!

  • Pingback: Best Way To Delete W3 Total Cache | Scott Andrew McNew

  • Anonymous

    Thanks !  I have also removed W3, although mine was easier, but I had to go delete the files mentioned by you.

    I also felt Quick Cache performs better, after all, it does the basics, which is all I need.  Being lightweight is good too.

    I’m getting old and tired too *lol*

  • http://clearskywebworks.com/ Leslie

    Hi, Dion

    Thanks very much for writing this post. I’m pretty sure you just saved me some headaches down the track!

    I have no doubt W3 Total Cache works really well, but — as you say — if it conflicts with too many other plugins, etc. then you could argue it doesn’t work that well at all.

    But what would I know?

    Anyway, thanks for the removal steps. Worked like a charm!

    All the best,
    Leslie  

    • http://journalxtra.com/ Dion de Ville

      Glad to help. I’ve felt 100% less stress since I removed it, lol.

  • Dean

    Hi, I am uninstalling it as well, it keeps taking a lot my page content down and screwed up my themes as well which all was fine till using this W3 total cache this plugin is trash in my opinion. Thanks for the instructions

  • Garry

    I’m unclear about one of your steps above . . .   #9. “Check the site’s .htaccess file has no W3TC re-write rules in it”

    I don’t know enough to know which ones would be from W3TC.  Here is what I have:

    RewriteEngine OnRewriteBase /RewriteRule ^index.php$ – [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]Are this standard or from W3TC?Thanks.

    • http://journalxtra.com/ Dion de Ville

      Hi Garry, if that’s all you have then you’re good to go. They’re the WordPress rewrite rules.

  • http://www.TechChase.in TechChase

    Thanks for clear steps..really helped while removing W3 Total Cache

  • Mike

    Excellent write-up! Thank you!

    I think I’m good to go except for the .htaccess-related stuff. I have the following in my .htaccess file (appearing above some 301 redirects that I would like to keep there).

    —-
    # BEGIN W3 Total Cache

        SetEnvIfNoCase Accept-Encoding (gzip) APPEND_EXT=.$1

        RewriteEngine On
        RewriteCond %{REQUEST_URI} /$
        RewriteCond %{REQUEST_URI} !(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register).php|wp-.*.php|index.php) [OR]
        RewriteCond %{REQUEST_URI} (wp-comments-popup.php|wp-links-opml.php|wp-locations.php) [NC]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =”"
        RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|wordpress_[a-f0-9]+|wordpress_logged_in) [NC]
        RewriteCond %{HTTP_USER_AGENT} !(bot|ia_archive|slurp|crawl|spider) [NC]
        RewriteCond /home/.pru/heffern/obliviousinvestor.com/wp-content/w3tc/pgcache/$1/_default_.html%{ENV:APPEND_EXT} -f
        RewriteRule (.*) wp-content/w3tc/pgcache/$1/_default_.html%{ENV:APPEND_EXT} [L]

    # END W3 Total Cache
    —-

    Is it safe to delete all of that?

  • Mike

    Update: I went ahead and deleted that from the .htaccess file after backing it up. Seems not to have caused any problems.

    There still must be something I’m missing though, because every time I try to save anything (a post, or page for instance), I get an error message:

    Warning: Cannot modify header information – headers already sent
    by (output started at
    /var/www/vhosts/obliviousinvestor.com/httpdocs/wp-content/themes/thesis_18/custom/custom_functions.php:1)
    in /var/www/vhosts/obliviousinvestor.com/httpdocs/wp-includes/pluggable.php on line 866

    • Mike

      Update #2: Apparently that error was caused by accidentally entering a line break in a file that I had been checking for W3TC-related code. After deleting it, everything is peachy. (And all W3TC-related stuff seems to be gone as far as I can tell.)

      Thanks again for the helpful guide. :)

    • http://journalxtra.com/ Dion de Ville

      You’re welcome Mike, I’m glad you solved it. Would have been here sooner but have been writing a script.

  • Zlaya123

    This is the best W3TC removal tutorial! Thank you very much.

  • Neesa Cambay

    Pleasing thank you so much for this information   

    php web development

  • http://profile.yahoo.com/Z3HSCJH7K5AFUSZ5JZBPNQHNZY Aminka Ozmun

    Just wanted to say that the latest version of W3 Total Cache seems very well-behaved; I had only to delete “w3-total-cache-config.php” — everything else was apparently removed by the uninstall process (deactivate and delete)!!

    Now I just hope my site works again…I had to take out W3 Total Cache due to conflicts with my shopping cart plugin!

    • http://journalxtra.com/ Lee hodson

      It seems to conflict with a lot of plugins. I’m glad the uninstall worked well for you :)

  • Dan

    Thanks so much for this write-up. Worked like a breeze.

    Remember from an older site that unistalling W3TC drove me nearly insane.

    Now absolutely painless.

All original content on these pages is fingerprinted and certified by Digiprove