Created
March 4, 2015 19:10
-
-
Save pdewouters/087040363dd5b56ab0ac 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
if ( is_multisite() ) { | |
global $wpdb; | |
// get current blogs from DB | |
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} ORDER BY blog_id" ); | |
foreach ( $blogs as $blog ) { | |
if ( is_main_site() ) { | |
continue; | |
} | |
switch_to_blog( $blog->blog_id ); | |
// Delete Cron schedules. | |
$schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM {$wpdb->prefix}options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) ); | |
foreach ( | |
array_map( function ( $schedule_id ) { | |
return ltrim( $schedule_id, 'hmbkp_schedule_' ); | |
}, $schedules ) as $schedule_id | |
) { | |
$test[] = $schedule_id; | |
//wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $item ) ); | |
} | |
restore_current_blog(); | |
exit(var_dump($test)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment