• Resolved christec

    (@christec)


    Hello to you and thank you for your work with this plugin which works wonderfully.
    I wanted to ask you if it was possible to have an example PHP code that I could use with a chrome task to clear the cache entirely and clear specific pages using:

    do_action (“swcfpc_purge_cache”);

    and

    do_action (“swcfpc_purge_cache”, array (“https://example.com/some-page/”, “https://example.com/other-page/”));

    I tried to clear the cache with it yesterday it is the secret key using cronjob but unfortunately it returns me html code 204 and it does not clear the cache.

    if i could use a php file to clear the cache with a cron job that would be great.

    Thanks to you, I wish you a very good day.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @christec,
    If you go to the Otrhers tab, you will see a dedicated URL to Purge the whole Cloudflare cache via Cronjob exactly as you are looking for. Screenshot: https://i.imgur.com/uenEY37.png

    Moreover for programmatically purging cache that’s how you are supposed to use them as mentioned under the FAQ tab.

    Thread Starter christec

    (@christec)

    I have already tested the dedicated URL but it doesn’t work for months. I also tested this cod but it doesn’t work either:

    <?php require( 'wp-load.php' );
    if ( function_exists( 'swcfpc_purge_cache' ) ) {
    	do_action("swcfpc_purge_cache");	
    }
    Plugin Contributor iSaumya

    (@isaumya)

    Hi @christec,
    What happens when you run the dedicated CRON URL to purge the cache? Did you check the logs? Make sure the log verbose mode is set to High.

    Thread Starter christec

    (@christec)

    Hi @isaumya, I fixed the problem, and found a code that works. Thank you for your help and your time.

    <?php 
    define('DOING_CRON', true);
    require_once('wp-load.php');
    do_action("swcfpc_purge_cache");
    Plugin Contributor iSaumya

    (@isaumya)

    Glad to hear that @christec. 🙂

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

The topic ‘Need to see the PHP code to clear the cache’ is closed to new replies.