Support » Plugin: W3 Total Cache » add_action (plugin) even with Cache ON

  • Resolved Ricard Torres


    Hi Frederick,

    I was wondering if it is posible to use the add_action function even with caching the page.

    I have a Stats plugin wich calls:


    function es_pageviews(){
    	if(is_single() || is_page()){
    		global $post;
    		$pv = get_post_meta($post->ID, '_pageviews',true);
    		update_post_meta($post->ID, '_pageviews', $pv+1);

    Very simple, as you can see.

    Using W3 Total Cache it gets cached, of course.

    Is there any chance I can force it to run the function? (even if the W3 Total Cache shows the static page as usual)

    I mean… update the post_meta “on background”.

    Waiting for answer,


Viewing 3 replies - 1 through 3 (of 3 total)
  • I’ve tried:

    <!-- mfunc -->es_pageviews(); the_pageview();<!-- /mfunc -->

    1) I’ve added mfunc exception in the Minification settings.

    2) I’ve turned off the Database Settings.

    It works.

    I activated the Debug Mode for the Database but I don’t see the page views query 🙁

    Is there any way I can turn ON the Database Caching but adding an exception?

    Thank you.

    Plugin Author Frederick Townes


    mfunc will not support any WordPress code because caching runs before WordPress can ever load.


    Like I said it works for now but with the dabase cache off 🙂

    As you can see here

    The page is cached but the pageview counter (under the title) keeps counting.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘add_action (plugin) even with Cache ON’ is closed to new replies.