How to Use W3 Total Cache

Clear WordPres Cache

With over 1 million active installations, W3 Total Cache is one of the most popular ways to optimize and manage the cache for your WordPress site. This can result in faster load times and less strain on your server, which can also help your SEO (search engine optimization) efforts.

Learn how to improve WordPress performance with our NGINX-powered WordPress Hosting.

How to Optimize WordPress with W3 Total Cache

By default, WordPress is a dynamic CMS (Content Management System). This means that for every visitor request that WordPress has to process, it must first connect to the database to see if the requested page even exists.

In a lot of cases, this might not be problematic on a site that doesn’t receive much traffic. However, a sudden surge in traffic caused by search engine bots, or just a general increase in normal traffic can quickly cause your WordPress site to use up a lot of CPU resources from the server while trying to fulfill needless duplicate requests again and again.

You can counter this increase in CPU usage by implementing a caching plugin. What these do is cache the first visitor’s request of a new page to a plain HTML file on the server. Then, when another visitor comes through and requests the same page, so long as the page wasn’t updated in your administration section, or updated by a comment, the cached HTML page will be served.

This can greatly reduce CPU usage of your WordPress site very easily. As an example, let’s say you had 100 views of your front page. Without caching that would require the same database query to have to run 100 times, and every time it’s just getting back the exact same data anyway.

With a caching plugin, only the first user would have the database query run to generate the cached HTML file. Then, the next 99 visitors would get that cached HTML served to them right away, without having to wait for any database activity to complete.

This is just about always a win-win, because your visitors don’t have to wait as long for your pages to load, and you’re reducing the impact of WordPress’s requests on the server’s performance.

Please note that database caching is not recommended for Shared Hosting as this process is dependent on the disk speed of the server. Due to the nature of shared system resources, disk speed may be limited and as such database caching may adversely affect the performance of your site. We recommend experimenting with different caching techniques to see which works best for your site.

  1. Install the W3 Total Cache plugin by BoldGrid.
    Installing W3 Total Cache
  2. From the left-hand menu, you should now have a new Performance section. Hover over this and click on General Settings.
  3. Scroll down the general settings page ensuring that the following section is enabled. Then, click the  Save all settings button.
    Page Cache:
    Enabling Page Cache in WordPress
    Minify:
    Minify CSS and JS Files
    NOTE: If you are using minify, make sure to enable the option, save it and then immediately look at your WordPress site to make sure that the site looks normal. If you see problems with formatting, then it’s possible that a theme or plugin is causing issues due to the minification. You should then disable minification and not use this option with your website.

    Opcode Cache (in this example it was not available on my server):
    Enabling Opcode Cache
    Database Cache:
    Turn Database Caching on
    Object Cache:
    Turn Object Caching on
    Browser Cache:
    Turn Browser Caching On
    CDN (you must be subscribed to a 3rd party service):
    Enabling the CDN Option
  4. Hover over Performance again in the left-hand menu, and click on Page Cache.
  5. Ensure that these options have a checkmark beside them, then click on Save all settings:

    β€’ Cache front page
    β€’ Cache feeds: site, categories, tags, comments
    β€’ Cache SSL (HTTPS) requests
    β€’ Cache 404 (not found) pages
    β€’ Don’t cache pages for logged in users
    β€’ Don’t cache pages for following user roles (only use this if you want to disable cache for specific roles)
    Enable Page Cache
  6. Finally to confirm that you’ve set up everything correctly, in your web browser open up your site and hit (Ctrl-U), or go to View -> Page source to view the source of the page. Scroll to the very bottom of the page and you should see the W3 Total Cache banner letting you know the page has been optimized.
    W3 Total Cache Source

How to Clear WordPress Cache

Clearing your WordPress cache can be something you may need to do from time to time when using a caching plugin to speed up WordPress. If you make changes to your WordPress site and don’t see the changes when visiting the updated page, you may need to clear your cache. This is because the caching plugin could still be showing the cached version of your page.

To force your WordPress site to show your most recent changes right away, you can delete the cache. Below are steps to clear the WordPress cache in the Dashboard and via WP-CLI.

Clear Your Cache in the Dashboard

  1. Login to your WordPress Dashboard.
  2. Hover over Performance, then click Dashboard.
  3. Click the empty all caches button.
    Delete Server Cache

Clear Your Cache in WP-CLI

  1. Log in to SSH or cPanel Terminal.
  2. Navigate to your WordPress directory.
  3. (Optional) Ensure W3TC is installed and active: 
    wp plugin status w3-total-cache 

    You should receive the plugin name and Active status.
  4. To purge URLs within your content delivery network (CDN) and Varnish (if enabled): 
    wp w3-total-cache cdn_purge

  5. To flush other caches:
    wp w3-total-cache flush an-attribute-below
    all
    posts β€“ page and posts cache
    post β€“ page cache
    database
    object
    minify
    For example: 
    wp w3-total-cache flush all

How to Import or Export W3 Total Cache Settings

There may be times when you want to backup your settings or use them on a different site. Follow along and we’ll walk you through importing and exporting your W3 Total Cache settings in the Dashboard. We will then show you how to import a settings file via WP-CLI.

Import/Export Your Settings From the Dashboard

  1. Log in to your WordPress dashboard.
  2. Under Performance, select General Settings.
  3. At the bottom, export your settings by clicking the Download button.
    Download Cache Settings
  4. Import your settings by clicking the Choose File button to select your backup (.json) file. Then, click the Upload button.
    Upload Settings

Import Your Settings with WP-CLI

  1. Upload the file to your cPanel account.
  2. Log in to SSH or cPanel Terminal.
  3. Navigate to your WordPress directory.
  4. (Optional) Ensure you’re in the correct directory: 
    wp option get home && wp option get siteurl

    You should receive your domain twice.
  5. (Optional) Ensure W3TC is installed and active: 
    wp plugin status w3-total-cache

    You should receive the plugin name and Active status.
  6. Run this command: 
    wp w3-total-cache import file-path-to-filename
JB
John-Paul Briones Content Writer II

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

73 Comments

  • Hi

    I am using wp super cache.

    I publish about 15 article every day.

    The cache updates itself.

    But sometimes the website have a ram and cpu heavy load.

    Should i remove cache every time i add new posts or just leave the plugin update cache itself?

    be noticed, I have a 30 visitor at same time on a vps of 2 vcpu and 8 Gb ram.

    • It is difficult to say without looking at the specific nature of your traffic but as a test, you could try adjusting the update interval to see if affects your site. If your problems persist you can submit a ticket to our Live Support team to see if they can help you determine what is using up your resources.

      Thank you,
      John-Paul

  • Hello

     

    I am using wp Total cache on my website https://hdmotionmovies.com/

     

    I want to change it to WP Super Cache.

    Can i do it? Is it safe?

    • It can be a lot of work switching caching plugins. Often, the caching plugin writes rules in the htaccess file. Removing the plugin does not remove the code it’s created and it can interfere. Why are you looking to switch caching plugins?

  • Hi,

    without plugin you can remove cache usning FTP

    To remove cache just go to /wp-content/

    And rename cache forlder like cache____

    Then relode your site all changes you done on site showing effect ….

    And you got new cache folder inside /wp-content/

    Thanks

     

  • (I know this post is old, but the VPS and caching plugin conflict caught my eye when looking for something else.) If you are on bluehost with VPS, check in the performance tab if the varnish cache is running. If you are using W3 Total Cache and varnish is also running, you’ll likely have site issues. Clear cache in varnish and turn it off.

  • to get right facebook image use facebook debug pluggin. debugg the page and then share will work properly with right featured image

  • 1.  How can I find the folder where the cached data is?

    2. Does the caching go to a particular folder?

     

    3. Is there way for me to track how much data is been cached?

  • hey guys,

    or the caching on sharing into social platforms, you can debug and fetch the changes using for instance facebook debug tool:

    re-rendering the new content will show you what will really apear,

    and that includes titles, og images, descriptions, links ….

    try this: https://developers.facebook.com/tools/debug/

     

    Contact me if you need help

     

  • Hi. I’m using Word Press and have pages showing up in my website menu that I deleted! I have to caching plugin and see no way to clear the cache. I as using Q and A plugin for FAQs. Had 2 FAQ pages show up in menu, tried deleting pages and have gone as far as to remove the plugin! Hoping to start fresh with no trace of the FAQ pages in the menu. But THEY ARE STILL THERE. Help please.

  • I have installed w3 total cache and the empty cache button was greyed out and non-funtional. so then i installe wp super cache and it does not show up in settings as you said it should– so how can i make this work? I have been building my website and making tons of changes and they are not showing in chrome but are in firfox so i ahve been instruced to empty my cache but can’t seem to be able to do it. thanks mary

    • Hello manikandan,

      Thank you for contacting us. The article above explains how to clear cache in W3 Total cache, and WP Super Cache.

      If you are using a different plugin, let us know so we can provide steps for you.

      Thank you,
      John-Paul

  • thanks bro.I was having problem with the wordpress posts updates and this solved the problem.

     

    cheeer..keep up the good work

  • I have Not Getted Any Answer of Previous Question From Your Side ..

    okay 

     

    I Want To Show Content Page With Index Page On Google search ..

    As:     Eshooper.com

    Contectus                             Aboutus 

     

    RelatedSearch                     ShopCart

     

    As It On When User Search My Webiste On Google Search . Please Give Me Soltution For That ….ASAP

     

    Thanks In Advanse..

    • Hello,

      When seeing the Google search results, I see information for Nike shoes where the description should be. This could be the result of a hack, in which you need to check the files on your account to see where this code is being inserted, it could be cached in your WordPress, so clearing it may help, or it may be still showing from Google’s side. In the last case, you need to have the WebMaster tools recrawl the site.

      If the WordPress and Google options do not work, then it is likely a hack of some sort on the site. You will need to either find someone who can locate and remove the hack code or restore from a backup from before the hack. This may cause a loss of data in either case.

      Kindest Regards,
      Scott M

    • Hello Prashant,

      I’m not quite sure what you are asking. Can you provide an example of what you are looking for?

      Kindest Regards,
      Scott M

  • Dear Edens,

     

     

    I have Some Changes In My Meta Tag Thas provide By Some Exsperts But . After Google Crwal Not Changingg Any Thing I M So  disappointed  please give me some suggestion .. url   hearforyou.com.au

  • Hello Everyone ..

    I Have Face A Problem in My WordPress Site .. My Description Is Show Other Not related My Site For Home page .. Actual description Not Show When Google Search ..

    Please Give Some Soltution For That .

    • Hello Prashant,

      Can you please provide your full url so we may investigate what is going on? Also after you make changes to your meta tags be sure to have Google Webmaster tools re-crawl your website.

      Best Regards,
      TJ Edens

    • Hello Debasish Halder,

      Sorry for the problem with your blog not writing to cache. Have you tried removing it (following its documentation) and then re-installing it? It’s possible that the cache file is corrupted. You will probably need to remove the cache plugin first in order to login to the admin. Try our troubleshooting plugins article first. If you continue to have problems, please provide more information about the issue such as your domain name and error messages.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

    • Hello indradev,

      Thank you for contacting us. Disabling the plugin should stop it from caching your wordpress site.

      We are happy to assist you further, but will need some additional information.

      What caching plugin are you using?

      Thank you,
      John-Paul

  • I do not have any cache plugins.

    I have only pages, no post so I do not haave much problem exepted when login in, getting and old deleted user insted of my username (remember me). not a big deal bu ennoying.

    Can I delete all folders inside the wp-content/cache forlder?

    Thanks

    • Hello pierjean,

      Yes, you can delete all files in the wp-content/cache folder without any harm.

      Kindest Regards,
      Scott M

  • Hi,

    On several sites I see people writing about the fact that Google is crawling to see if you’r mobile friendly and that caching would make the googlebot see 404 errors because the links they saw a few days before are missing after caching… 

    I would like to use a caching plugin like WP fastest cache, but for improvement in Google ranking to make the site faster. So if google can’t crawl it anymore, the ranking would go down.. Can anyone clear this up?

    Thanks!

     

    • Hello Ladybird,

      Thank you for contacting us. Caching pages does not make them inaccessible to Google, it should just server the requested pages faster. Many WordPress sites use caching plugins, and are successfully crawled by Google.

      I recommend using Google Webmaster Tools to review and troubleshoot any 404 errors.

      We would be happy to help you review any specific errors you may receive, if you provide them.

      Thank you,
      John-Paul

  • The WP Super Cache plugin was causing my admin toolbar thats at the top of my website when I’m logged in, visiable to all visiters and possibly accessible by them too.  I freaked and logged out immediately not knowing if anyone could just click on ‘dashboard’ and enter the admin area of my site.  Even after I logged out, the bar was still visable as if I were still logged in and if you clicked on anything it would go to the wp login page.  I disabled and deleted the plug in and all is back to normal.  I had to quit W3 total cache becase my site was showing up as a mobile site on a pc.  So I was hoping WP Super Cache would work for me.  Any ideas? 

    • Hello christy,

      Thank you for your question. Since both caching plugins are causing problems, you may want to try a different caching plugin.

      Alternately, you can attempt to work through the plugin issues. Since many people use WP Super Cache, and W3 total cache, there is a lot of resources when troubleshooting problems.

      Turning on Error Reporting in WordPress may provide more detailed error messages.

      Thank you,
      John-Paul

  • this plugin is much more good for cache WP Fastest Cache i use it on my website instead of W3 total cache

    • Hi!
      Using one of these plugin AND a service like for example Cloudflare, could be a good choice to speed up a little more website performance? Thank you! πŸ™‚

    • Hello Korgzero,

      It could speed things up more, yes. CDNs like CloudFlare store the content across multiple servers and send it to the visitor from the closest one.

      Kindest Regards,
      Scott M

    • Hi Scott, thank you very much! πŸ™‚
      I noticed this annoying issue:
      I’m on a VPS server. Using W3TC, when I publish a new post I get a 500 error, so I need to purge manually the cache. Is there a way to purge automatically the cache when a new content is posted? Thank you again… your help is really precious πŸ™‚

  • Hy Jeff, its good to see that you are talking on some small but effective points on WordPress. My question is, I published around 3-4 posts daily, can emptying cache several times a day good/bad or it will not make any changes to the site?

    • Hello Ayush,

      Thanks for the question. If you are making 3-4 posts daily and your caching plugin is caching those pages, then yes, you should clear your cache AFTER have you completed your latest entries. Otherwise, it’s possible that your visitors may say a cached page without your latest blog entry. I hope this helps to answer your question, please let us know if you require any further assistance.

      Regards,
      Arnel C.

  • Hi Jeff, thanks for the helpful article. Quick question:

    Can you explain what the individual “Purge from cache” feature is doing (link W3 Total Cache adds under my pages when in my Admin–listed right before the WP’s Duplicate page feature)?

    Thanks

    • Hello Lewi,

      The Purge from cache option removes all tmp files so that changes you make to website will show up in your browser.

      Kindest Regards,
      TJ Edens

  • I followed your links. I solved my problem by select the custom permalink ans put /%postname% there. Thanks a lot for your advise Arnel. All the best for you.

  • I just installed WP Super Cache. When I clicked it shows a message:

    A custom url or permalink structure is required for this plugin to work correctly. 

    Please go to the Permalinks Options Page to configure your permalinks.

    I have choose the permalink that I like, but this message came again.

    Please advise. Thanks

     

     

     

    • Hello Hyip,

      Sorry for the problems with Supercache. Basically, the plugin is looking for a “pretty permalinks” setup. It’s not clear what you have set for the permalinks, but either it was not saved, or you something set that the plugin doesn’t like. The issue is discussed by the plugin author here. If you want to know more about “pretty permalinks” check out this link.

      If you hav eany further questions, please let us know.

      Regards,
      Arnel C.

  • Hi All,

    I am facing critical issue with my site related with caching plugin actually I installed supercache plugin, after installation of this plugin I found that <a href=”https://www.codehours.com”>Codehours.com</a> is not working properly means pages do not open properly so my question is how to remove plugin compleletly or how to delete caching files even my dashboard is not open please help me its urgent.

    • Hello Milind,

      You will need to clear the cache files by following the supercache plugin as you need access to the dasboard on the shared server. You may want to disable the plugin (from the plugin menu option on the left hand sidebar) and see if that helps. You can disable the plugin from your cPanel by entering the file manager and then navigating to the wp-content folder. You can then enter the plugins folder and simply rename the folder for the supercache.

      Kindest Regards,
      Scott M

  • Hey, thanks for helping. The problem that I have is in the Super Cache plugin. I use IE and Chrome 10 browsers in private mode. If I make a change, for example, a comma in a title in the sidebar, there not appears. Only appears when I disable this plugin. :/

    • Hello Fabio,

      Are you saying that you have this same problem, even after clearing the cache as per the instructions above? Once the cache is cleared and rebuilt, then you should be able to see the changes after you clear your browser cache. Browser caching would still occur in private mode. It’s just not saved when the session is closed. Try clearing the browser cache in private mode and then see if the problem recurs.

      Regards,
      Arnel C.

  • Hey, I use Internet Explorer and Google Chrome in private mode. No historical or cookie is saved in the browser. Could be a problem other than the browser?

    • Hello Fabio,

      Sorry to hear that you’re having a problem. This doesn’t sound like a browser issue. Have you tried it without the private mode to see if the problem is occurring as well? We would need to see a URL, and a before and after situation where you made a change and then tell us what we should be seeing. Give us a little more information and we can try to help you out with the issue, please.

      Regards,
      Arnel C.

  • Hi, How soon can we expect when we do an update and see what was done? For whenever when I update a widget or article, do not see the modification πŸ™

  • My WP doesn’t even have a performance option and the first option doesn’t show up either. Why is this and how do I clear my cache otherwise?

    • Hello Alyssa,

      Thanks for your question! If you’re not seeing the performance section in your menu, then you most likely do not have the caching plugin loaded. You can find out how to use WP Super cache here and W3 Total cache here. Once you have it loaded, then you can use the article above to clear the cache.

      Regards,
      Arnel C.

  • Hi I have 8 WordPress websites, that are not caching on Google, because of robots files and the robots files are good to go.. Can you help me for the same?

     

    • Hello,

      Thanks for your question. As long as your robots.txt file is not blocking google, they should crawl your site automatically.

      If Google is not indexing your site, you can request that they reconsider crawling it in Webmaster tools; here is a walk through guide.

      If you have any further questions, feel free to post them below.
      Thank you,

      -John-Paul

    • Hello Deamon,

      Yes, in order to use the cache on publish events, you would check that off. And also include conditions for the purging cache.

      Regards,
      Arnel C.

    • Hello Deamon,

      I looked at caching plugins above and both of them do allow you to “clear” the cache when you publish a new or modified article. WP Super Cache has the option in the Advanced section. W3 Total Cache has a Preload Cache option and Purge options that basically do the same thing (you would want to purge the cache first, then do a pre-load based on the modification event.

      I’m not sure one does it better, though W3 Total Cache allows you to specifically define it as opposed to WP Super Cache where it is simply a checkbox in the Advanced section.

      I hope that helps to provide the information you require!

      Let us know if you have any further questions or comments!
      Regards,
      Arnel C.

  • How do I can clear the cache if you do not have that pluging? 

    When I share on facebook gets old images

    • If you’re not using a caching plugin on your WordPress site, then you would not have any sort of caching enabled. I have noticed that Facebook will indeed grab an incorrect image for the thumbnail quite frequently which unfortunately is unavoidable.

Was this article helpful? Let us know!