Support » Plugin: WordPress Popular Posts » View count only updating when W3 total Chace caches are cleared

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Hector Cabrera


    Hi Morten, long time no see!

    Can you please post your site’s URL?

    Plugin Author Hector Cabrera


    Thanks! Just checked your site and it’s working for me (screen capture).


    Interesting – I didn’t test that scenario – that is working for me as well.

    The problem is in the post – the counter is not updating.

    Plugin Author Hector Cabrera


    Ah, that makes more sense: you’re talking about the wpp_get_views() template tag. You got me worried for a moment hehe.

    Anyways, the problem is that the entire post page is being cached – including the views count. This is something that WPP cannot prevent as of now (not even the older versions, actually) since W3TC is caching everything.

    While I’m not entirely familiar with W3TC, I know they had something called fragment caching. With it, W3TC allowed users to keep portions of a given page dynamic. I’m not sure if this feature is still available or not, but if it is then you could try something like this to solve the issue:

    1. Add this to your wp-config.php file: define('W3TC_DYNAMIC_SECURITY', 'E7C5F12EBCDA5F83A41BF33D778ED' );, where E7C5F12EBCDA5F83A41BF33D778ED is a random string that serves as a security key, I suppose.
    2. Then, in your single.php file change your code so it looks something like this:
      <!-- mfunc E7C5F12EBCDA5F83A41BF33D778ED
          echo wpp_get_views( get_the_ID() ) . " views";
      <!--/mfunc E7C5F12EBCDA5F83A41BF33D778ED -->

    You can see more on this workaround here.

    Give it a try and let me know what happens, alright?

    Edit: apparently, the wp-config part isn’t really necessary according to this comment. That user also linked to this other comment with a sample code that apparently works fine (and also explains a bit more how to use fragment caching).

    OK – many thanks for your clarification and suggestions.

    My main concern was that the counter was not updated at all after plugin update, but it is as I can see when I’m logged in as Admin, the counter in all posts are correctly updated from the very last visit, as Admin is excluded from cache.

    Thanks for your speedy and detailed responses! And of course for a great plugin 🙂


    Plugin Author Hector Cabrera


    No problem, I’m glad to be of any help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘View count only updating when W3 total Chace caches are cleared’ is closed to new replies.