Automattic\WP\Cron_Control\Internal_Events::confirm_scheduled_posts PHP Метод

confirm_scheduled_posts() публичный Метод

Ensure scheduled posts have a corresponding cron job to publish them
    public function confirm_scheduled_posts()
    {
        global $wpdb;
        $future_posts = $wpdb->get_results($wpdb->prepare("SELECT ID, post_date FROM {$wpdb->posts} WHERE post_status = 'future' AND post_date > %s LIMIT 25;", current_time('mysql', false)));
        if (!empty($future_posts)) {
            foreach ($future_posts as $future_post) {
                $future_post->ID = absint($future_post->ID);
                $gmt_time = strtotime(get_gmt_from_date($future_post->post_date) . ' GMT');
                $timestamp = wp_next_scheduled('publish_future_post', array($future_post->ID));
                if (false === $timestamp) {
                    wp_schedule_single_event($gmt_time, 'publish_future_post', array($future_post->ID));
                    do_action('a8c_cron_control_publish_scheduled', $future_post->ID);
                } elseif ((int) $timestamp !== $gmt_time) {
                    wp_clear_scheduled_hook('publish_future_post', array($future_post->ID));
                    wp_schedule_single_event($gmt_time, 'publish_future_post', array($future_post->ID));
                    do_action('a8c_cron_control_publish_rescheduled', $future_post->ID);
                }
            }
        }
    }