Automattic\WP\Cron_Control\Main::block_direct_cron PHP Method

block_direct_cron() public method

Block direct cron execution as early as possible
public block_direct_cron ( )
    public function block_direct_cron()
    {
        if (false !== stripos($_SERVER['REQUEST_URI'], '/wp-cron.php') || false !== stripos($_SERVER['SCRIPT_NAME'], '/wp-cron.php')) {
            status_header(403);
            wp_send_json_error(new \WP_Error('forbidden', sprintf(__('Normal cron execution is blocked when the %s plugin is active.', 'automattic-cron-control'), 'Cron Control')), array('status' => 400));
        }
    }