Created
September 1, 2022 19:29
-
-
Save bwmarkle/98532330919d063dea105ddffdb6d291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'update_option', function( $option, $old_value, $value ) { | |
if ( 'cron' !== $option ) { | |
return; | |
} | |
$json_old = wp_json_encode( $old_value ); | |
$json_new = wp_json_encode( $value ); | |
$old_contains = strpos( $json_old, 'boldgrid_backup_wp_cron_run_jobs' ) !== false; | |
$new_contains = strpos( $json_new, 'boldgrid_backup_wp_cron_run_jobs' ) !== false; | |
if ( $old_contains && ! $new_contains ) { | |
$core = apply_filters( 'boldgrid_backup_get_core', false ); | |
$logger = new Boldgrid_Backup_Admin_Log( $core ); | |
$logger->init( 'update_option.log' ); | |
// We want to include the trace to see what is clearing the schedule. | |
$e = new \Exception(); | |
$e = explode( "\n", $e->getTraceAsString() ); | |
$logger->add( print_r( array( | |
'$e' => $e, | |
), 1 ) ); | |
} | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment