phpwordpresscronw3-total-cache

PHP delete a cronjob on wordpress


I manually added to the child theme function.php the code found here: https://techjourney.net/automatically-flush-purge-w3tc-w3-total-cache/ to clear "w3 total cache"'s cache. Now despite adding the code supposed to stop the process as suggested by the same programmer, it's still going...

how can i stop and delete that cron? cause it's not even working daily as supposed but it's spamming it every seconds since days

this is the code to add that mf cron:

// Flush W3TC Cache
function tj_flush_w3tc_cache() {
    $w3_plugin_totalcache->flush_all();
}

// Schedule Cron Job Event 
function tj_flush_cache_event() {
    if ( ! wp_next_scheduled( 'tj_flush_cache_event' ) ) {
        wp_schedule_event( current_time( 'timestamp' ), 'daily', 'tj_flush_w3tc_cache' );
    }
} 
add_action( 'wp', 'tj_flush_cache_event' );

this the code supposed to stop it but doesn't work:

function tj_disable_auto_flush_cache() {
    wp_clear_scheduled_hook('tj_flush_cache_event');
}
add_action('wp', 'tj_disable_auto_flush_cache');

Solution

  • i used this in my function.php

    update_option('cron', '');
    

    and now it only shows the right crons in the list (i'm using a plugin to control crons on my wordpress)