Почему класс не срабатывает, ошибок никаких не выдаёт?
class Db_Optimize_Tables_Cron {
public static function load() {
add_action( 'init', array( __CLASS__, 'schedule_events' ) );
}
/**
* Schedule cron events, runs during init.
*/
public static function schedule_events() {
if ( ! wp_next_scheduled( 'db_optimize_tables_cron' ) )
// wp_schedule_event( time(), 'daily', 'db_optimize_tables_cron' );
wp_schedule_event( time(), 'hourly', 'db_optimize_tables_cron' );
add_action( 'db_optimize_tables_cron', array( __CLASS__, 'optimize_tables' ) );
}
public static function optimize_tables() {
global $wpdb;
$bDebug = TRUE;
$tables = $wpdb->get_col( "SHOW TABLES" );
foreach ( $tables as $table ) {
if ( $wpdb->query( "OPTIMIZE TABLE $table" ) !== FALSE ) {
if ( $bDebug ) {
error_log( "Db_Optimizer ran successfully on $table" );
}
}
}
}
}
Db_Optimize_Tables_Cron::load();
Вот тут - /wp-admin/admin.php?page=wc-status&tab=action-scheduler и тут смотрю - /wp-admin/tools.php?page=action-scheduler абсолютно пусто.