Lite Cache

Lite Cache is an efficient cache plug-in for WordPress. It’s simple, like Hyper Cache but easy to configure.

Lite Cache is at end of life. All it’s features has been merged in Hyper Cache. You can install Hyper Cache e delete Lite Cache without loose any performance.

Please, to migrate to Hyper Cache, take not of all Lite Cache configurations. The complete dismissing procedure is described below.

If possible use the forum to ask for help.

Lite Cache is compatible with gzip compression and handles it automatically.

Lite Cache works even with commentators, people who left a comment in the past. Other caching plug-in usually are not able to serve cached content to commentators. This is of great importance for blogs with many returning commentators.

Lite Cache can detect mobile devices, create a separate cache for them and can force a secondary template for mobile devices.

Lite Cache can cache the pages even when the visitor is a logged in user, but it is not recommended and the option should be enabled ONLY if you know what to change in your theme to avoid disaster.

Lite Cache is actually used on a blog,, which counts over a 1,500,000 page views per month and is saving the little virtual server where it is installed (with other two blogs). It is used on my personal Italian blog too,, if you would see the page signed by Lite Cache.

Install it and go to the options panel to find how to configure it.


Get Lite Cache from WordPress Plugin Directory.


To totally dismiss Lite Cache removing any element of it’s installation, you should follow those steps.

  1. delete the options from the database using the special button in the administration panel
  2. deactivate the plugin and remove it’s file (from the WordPress plugin panel)
  3. delete the file wp-content/advanced-cache.php
  4. delete the folder wp-content/cache/lite-cache
  5. Optionally you can remove the define(‘WP_CACHE’, true) in the wp-config.php file if you plan to NOT install another cache plugin

The Vary header

When a site serves different page versions to different devices (usually desktop and mobile) Google recommends to add a Vary header. This header, in few words, says: pay attention that the URL requested can put out different content depending on … (and the value of the Vary header determines what is the discriminant).

Lite cache sends this header when it manages the compression and when a different mobile theme is used, to be fully compliant with Google responsive design recommendations.

More about:


Is it compatibile with multi-site installation?

Never tested, but I think it is not compatibile is you use third level domains.

Is it compatible with plug-ins designed to detect mobile devices?

Yes if the list of mobile agents configured on Lite Cache is the same of the one configured on your mobile plug-in.

How does it work?

Lite Cache grabs the generated page HTML of almost any page of your blog and stores it on a disk cache. It grabs the
page only on first request, the cache content is not generated on first activation.

Lite Cache, dfferently from other cache systems, operates even when the blog is surfed by people who commented the blog
and grants (when possible) to fill the comment box fields with user’s data without exposing it to other visitors. If your theme
blocks this feature, I cannot fix it and the comment box fields will be left empty.

Lite Cache does not operate under some circumstances:

  1. When a not found page is generated (404 error)
  2. When the feed is generated
  3. When a WordPress user is logged in and surfs the blog if not explicitely enabled
  4. When the virtual robots.txt page is generated
  5. When a request is a trackback from other blogs
  6. When a plugin force the global variable “$cache_stop” to true (read more on my standard proposal for cache systems)
  7. When a request matches one of the excluded paths

When the cache is cleaned up (invalidated)?

Lite Cache cleans up the cache when the blog content is changed, with these rules (no, they are not configurable):

  1. When a post is changed its cached page is removed with the home, tags, type, current year, feeds and categories cached pages
  2. When a post gets a comment only its cached page is removed (that removes the pages comments and the comment feed as well)

How can I check if it is working?

  1. Open your browser and go to the blog admin side.
  2. Log in.
  3. Log out (on right top there is that option).
  4. Open a blog page.
  5. Reload it a couple of time.
  6. Look at the page HTML source: last line should be looks like <!– lite cache… –>

It does not work!

Have you tried to follow the steps on previous answer?

It still does not work.

May be Lite Cache is not compatible with your installation: do not use it. My blogs use it and it works on them. It happens.

Does Lite cache correctly manages the paged comments?

Yes, it does.

Are feeds cached?

Yes, they are and there is no option to avoid that.

Can I use a different folder for the cache?

Yes, under advanced options you can set that. Pay attention to “point” to a writable folder otherwise no file will be written. This option is useful when you have a partition which is quicker than the one where the blog is installed or to avoid to have cache file inside the blog folder (that should be excluded from backup and that, usually, use a lot of disk space).

There is an option to stop the cache for specific agents?


There is an option to stop the cache for specific cookies?


There is an option to stop the cache for specific URLs?

Yes. On administration panel you can set a list of URLs (to be correct URIs) to be excluded from the caching process. every requested page address is matched with the list of “to be rejected” URIs and it “starts with” on of them is skipped.

There are options to control the cache at post and page level (eg. on editing panel)?


Can I avoid to cache the home page?


Can I stop the cache for Google Bot or other search engine bots?


Does Lite Cache caches images?

No, it has no meaning, not only for Lite Cache usually for every cache system. If with “caching images” you means a CDN integration, no there is no CDN integration.

Does Lite Cache minify or cleans up the HTML code?

No, even with tidy installed, it creates too much issues with XML snipped from Facebook and others. I definitively removed it.

Does Lite Cache minify Javascript or CSS?


Does Lite Cache can use CDNs?


Can be used in conjunction with Apache Rewrite Engine and the .htaccess?

Yes, when you save the options the snippet of rules to copy inside the .htaccess. Not all Lite Cache options works using .htaccess rules. Some user’s reported a more efficient caching without using all that rules on .htaccess, but I really don’t have scientific tests.

It is mandatory to modify the .htaccess?

No, and if you don’t know how to modify it, please don’t try to edit the file. If you want to try, keep a backup. If the site does not show up after an .htaccess modification, restore the original .htaccess.

Does Lite Cache is compatible with mfunc?

No, it is not.

How can Lite Cache stopped on a specific page by third party plug-in or short code?

Any plug-in that want to avoid a specific page to be cached, must set to false the global variable $cache_stop. For example I force it to false on some of my plug-in short codes when they generate different output depending on who is navigating the site.

How to filter the cached content of a page

Register a standard WordPress filter with name “cache_buffer”: the buffer is passed on your function and your function can process it and return the modified content that will be stored. An example:

function my_cache_buffer_filter($buffer) {
return $buffer . ‘&lt!– I was here –>;

add_filter(‘cache_buffer’, ‘my_cache_buffer_filter’);

Can I set Lite Cache to cache only newer posts?

Yes, you can set Lite Cache to not store old posts into the cache. Usually this is recommendable with very big blogs which do not have traffic on old posts but only on the newer ones. It saves a lot of disk space and avoids that a single visit on a old post (by humans or bots) to use disk space.

The administrative panel is translated or translatable?

Actually not.

39 thoughts on “Lite Cache

  1. Howdy Stefano,

    I came here to thank you for an awesome plugin!

    I have spent all weekend trying different Caching plugins, and yours seems to be the simplest, lightest and most effective. Thank you!

    I wanted to offer some grammar and spelling fix suggestions, because I speak English as a first language (I’m Australian), and there are minor English spelling and grammar errors within the plugin.
    Normally I ignore these because nobody but myself see them (and I normally don’t care), but because your plugin has helped me so far, I will return the favour :)

    First of all, your Facebook icon (after the Go button) isn’t loading in the Options area. It’s using a relative href when it should be absolute “ img src=”NEWSLETTER_URL/images/facebook.png” style=”vertical-align: bottom”
    should be
    img src=”” style=”vertical-align: bottom”
    Or wherever your Facebook icon is stored.

    The Configuration tab is OK!


    Mobile tab:
    ” It make sense to disable the cache for mobile devices when their traffic is very low. ”
    should be
    ” It makes sense to disable the cache for mobile devices when their traffic is very low. ”

    You are using the term “make” in a future tense when you leave off the “S”, if you use it in that way, you would need the word “will”, “”It WILL make sense””, present tense is better anyway;
    “It makes sense”


    Advanced tab:
    ” Disable the compression if you got page served which results in a lot of odd characters. If change this setting you MUST clear the cache. ”
    could be
    ” Disable the compression if a page is served which results in a lot of odd characters. If you change this setting, the cache MUST be cleared.

    Formal grammar is “a page is served”, and is more formal than “you got page served” which is missing the “A”, “you got A page served” — which still not quite correct anyway.

    “Lite Cache is able to work with users who left a comment and completes the comment form with user data even on cached page. But the “awaiting moderation” message cannot be shown. If you have few commentators, you can disable this feature to get back the classical WordPress comment flow.”
    should be
    “Lite Cache is able to work with users who have left a comment and completed the comment form with user data even on cached page. However, the “awaiting moderation” message cannot be shown. If you have few commenters, you can disable this feature to get back the classic WordPress comment flow. ”

    “Have” is optional, but more formal than not using it.
    “Completed” is the correct past tense verb.
    “However” is also more formal than using “But”, at the start of a sentence.
    “Commenters” is the correct term for who you are describing. “Commentators” are people who narrate a sports game, with a microphone. Commenters are people like me who are Commenting on a post. :)

    “Agents to rejects”
    should be
    “Agents to reject

    No plural needed.

    “Cautiously!!!” should be “CAUTION!!!”

    Much more formal and more recognisable to English users. The red is a nice touch though!


    The rest (text copy) is very good! And the plugin itself is even better! 😀

    Regards, Jenkins

  2. I’ve found that this plugin does not remove any files from the cache. After a month I was to 2GB of cached data. To fix I’ve had to setup a cron script which runs nightly and deletes files only than 1 day.

    find /home/hydn/public_html/wp-content/cache/lite-cache/ -mtime +1 -exec rm -f {} \;

    I’m using all default settings (TTL is set to 1 hour). I’m not using .htaccess.

    If you confirm this as an issue I will donate towards fix.


    1. Hi, it’s not possible lo run a linux command from a blog… or better is not a general available solution. shared hostings do not allow that, windows hostings do not have that kind of command. The only viable way is to run a PHP process… If possible I’ll add it on future versions.

      In the meanwhile for your blog, you can run such a command with a cron.

  3. Hi Stefano
    Thanks for this plugin and the last update

    I do have a question :-)

    If i set the “Cached pages will be valid for to forever (0)”
    Will this still be valid ?

    When a post is changed its cached page is removed with the home, tags, type, current year, feeds and categories cached pages
    When a post gets a comment only its cached page is removed (that removes the pages comments and the comment feed as well)

    Also another question:

    If a post is changed like
    “When a post is changed its cached page is removed with the home, tags, type, current year, feeds and categories cached pages”

    Im correct when I say that all unchanged post stay in cache ? does it work as well with cache forever ?
    or does the whole cache gets killed?

    Sorry to be a bit complicated…..
    You cache is so cool i really love it
    We have a page with like 14k of posts on a small virtuell server

    pingdom and other speed checker mostly say speed below 3 secs… lol so awesome.
    even we dont have yet setup CDN yet for the images

    If you like to see the page look at my email for the url :)

    1. When a post is modified the post, home, categories, …, are invalidated. Always. Setting the expiration to 0 means that, if a post is in cache and never changed, it won’t be refresh automatically. If the expiration is set, it will stay in cache at most X hours.

  4. Hi Stefano,

    I have discovered that when returning commenters leave a comment on my blog when Lite Cache is activated, it pre-fills their name at FIRSTNAME+LASTNAME, the plus sign appears where a space should be.

    Disabling Lite cache stops this from happening. How can I fix it?

    Thank you,

  5. Hello, Stefano,

    I think Lite Cache is a great plugin. I have used before another very good plugin, Quick Cache, but Lite Cache even promote my site with 9-10 points on Google Speed Test!

    Unfortunately, I have two problems using Lite Cache – and at least the first one seems a major one to me.

    1. With Lite Cache, some pages on my site (WP & BP) that I want to keep only for logged-in users: e. g. Activity, Members, Groups – now are revealed to everybody (the plugin I use for hiding these pages for non-logged visitors is Private Pages). I added these pages at “URLs to exclude from cache”, but it seems it doesn’t work. Any suggestion on what happened, please?

    2. For Mobile, I keep it on Disabled Mode, because every time I choose otherwise, I mean the options for separate cache or bypass, I get a 503 Service Unavailable error for the mobile (the Google PageSpeed Insights gets
    “PageSpeed Insights received a 503 response from the server. To analyze pages behind firewalls or that require authentication, try the PageSpeed Insights browser extension.”.
    Do you have any idea why is that?

    I would appreciate any solution, because I really want to use Lite Cache.

    Thank you!


    1. The 503 can be a plugin bug, I need to check the code. To disable some page, you can add their (partial) URLs to the configuration.

      When a user is logged in the cache should be inactive, did you activate it even for logged in users? If so, disable it.

      1. Thank you for your reply!

        No, of course, I didn’t activate the plugin for the logged in users – that, in fact, puzzled me more about this unexpected problem.

        What do you mean by the partial URLs? I’ll tried many times with the entire urls of the pages, and also only with their names in the urls – unfortunately, with no good result. (It seems like the cache option for logged-in users is active – but it is not).

      2. Moreover, when I log in (as admin or regular user, doesn’t matter) from the front end, many pages (not all) looks like I am not logged (but I can see the pages, even if I am logged in or not). If I refresh them, one by one, finally it looks on each like I am logged in. Very strange!

        1. I managed, one way or another, to solve the first problem – it was, I guess, because of a conflict with CloudFlare, I don’t know exactly why and how, but, anyway, with strange and unexpected errors. I simply removed CloudFlare.

          I am very glad to use now LiteCache, it is great and simple – and really speeded my site in a spectacular way. According to my (limited) experience, it is the most effective cache plugin that I used.

  6. Great plugin. Compared to Hyper cache it improved server response time by 300-400 ms and also the total page load time.
    What is the purpose of .htaccess code? From my limited knowledge I think it is for pre compressing pages. And I’m not using mobile mode so can I omit #mobile and #mobile gzip section ?

      1. “Minification” should not break the CSS. But if the CSS is not perfect it may happens (or if the plugin is not updated with the latest CSS standards).

  7. Thanks for this great Plugin!

    I have a question. It seems that Lite Cache add a Java Script just before the <!– lite cache…. comment in all my documents. What is this and how can i disable it?

    Thanks a lot for your great work!

    1. That javascript is important. It lets the cache to work even when the surfer is a person who already commented in your blog. Most of the caches do not work with visitors who left a comment in the past since they have a cookie which is used to pre-fill the comment form.

      The javaScript deals with that, make the cache more efficient.

      1. Thanks for your reply. I deactivate all comments on my site (just a Portfolio). Can i deactivate this Java Script or doesn’t work the Plugin without it?

        Thanks for your help :-)

  8. Hello Stefano,
    Your plugin works perfect on my site.
    I have another question now, about the cache : Is it good to disallow it in the robots.text or not? Is there a risk of duplicate content?
    Thanks in advance for you answer and for your plugin which is so useful.

    1. Hi, what kind of disallow would you add? For the cache folder?
      If it is for the cache folder, it’s good to disallow it, but files on that folder will never be indexed.

  9. I was using lite cache and loved it. However something really strange happened today and now when I reactivate lite-cache I can get the admin part to load up when going to settings > lite cache. I tried removing and reinstalling from the plugins directory. Is there another place in the database or in the file structure where something might have been corrupted?

    1. Delete the file wp-content/advanced-cache.php and the folder wp-content/plugins/lite-cache and the plugin will be totally removed. Then you can reinstall it.

      Strange thing anyway…

    1. But do you find them in the lite cache folder? Or are they physical files? Anyway the url to exclude are


  10. Hello Stefano,
    First of all, many thanks for this very useful plugin. I’ve posted a couple of questions on the WP Support but got no answers till now so I dare to ask you directly here.
    My first question is about how to set up the valid time of the cache.
    I’m not a pro and I don’t know if a very short time is better , or a few hours, etc.
    My site has a low traffic, and is hosted on a shared server that runs with LiteSpeed.
    Since I added your plugin my loading time is much shorter and I’m very glad of that.
    See the test : <a href=";
    But I wonder about why I get grade D on cache static content?
    Any advice for those two questions?
    Thanks a lot, in advance.

    1. Hi, sorry is I missed to answer on wordpress I need to check if I enabled to notifications. About static content it has nothing to do with caching of html, it refers to header youy should set on server to enable caching at the browser level. The configuration on apache require mod_header or mod_expire.

      1. Many thanks Stefano for answering. I’ll check the server cache with my hoster.
        But could you give me an advice about how to set up the valid time in the plugin?
        I tried 4 hours and finally I’ve set it to 24 hours. Is that ok for a small site like mine?
        Thanks a lot for your patience!

        1. There is not a real answer, you can leave the value to 24 hours or more. On some blogs I set it to zero (it means indefinitely).

          Of course if you have widget which show the latest post, more old is the cached age more old are the listed posts. This is probably the main measure to decide the number of hours.

  11. Good plugin! But there is one big problem when categories which have not base (null-base). It’s seems to me the best way is to get path of each post’s category and to clear it’s cache separatly. Sorry for my english(

    1. The plugin know nothing about category with no base, and probably cannot detect them. Category with no base are usually managed by specialized plugins. It’s your case?

Leave a Reply