This could be modified as a function that takes an array of handles to eliminate or an array of handles to be preserved.
1 2 3 4 5 6 7 8 9 10 | $crons = _get_cron_array(); $hook = 'tj_flush_w3tc_cache'; foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[ $hook ] ) ) { unset($cron[$hook]); } if(!empty($cron)) $newcron[$timestamp] = $cron; } update_option('cron',$newcron); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.