Viewing 5 replies - 1 through 5 (of 5 total)
  • Ashok

    (@bappidgreat)

    Hello permag

    Do you mean when you create a new post you want to reset cache automatically?

    Then try the following code:

    add_action( 'publish_post', function() {
        $plugin_totalcacheadmin = w3_instance('W3_Plugin_TotalCacheAdmin');
        $plugin_totalcacheadmin->flush_all();
    } );

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Have a good day!

    Cheers
    Ash

    Hi Ash,

    Isn’t there a way to clear the cache once a user makes any change that invalidates the cache?

    Ie. I have a site that also runs woocommerce, and as soon as they change prices, make a product on sale or something like that, it does not clear the cache. (The customer is not admin on the site, and can therefor not clear the cache manually.

    Thanks!

    Thread Starter permag

    (@permag)

    when i send post , that dont show at my site and i have to delete cach Manually …

    Ashok

    (@bappidgreat)

    Hello @vitago

    Try the following code:

    add_action( 'save_post', function() {
        $plugin_totalcacheadmin = w3_instance('W3_Plugin_TotalCacheAdmin');
        $plugin_totalcacheadmin->flush_all();
    } );

    I have changed the hook to save_post. It should fire on every post save.

    Let us know if it works.

    Have a good day!

    Cheers
    Ash

    Ashok

    (@bappidgreat)

    Hello permag

    i send post

    What do you mean by sending post? Would you please clear this one?

    Have a good day!

    Cheers
    Ash

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘not clear cach After send post’ is closed to new replies.