|
18 | 18 |
|
19 | 19 | ignore_user_abort( true ); |
20 | 20 |
|
21 | | -if ( ! headers_sent() ) { |
22 | | - header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); |
23 | | - header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); |
24 | | -} |
25 | | - |
26 | | -// Don't run cron until the request finishes, if possible. |
27 | | -if ( function_exists( 'fastcgi_finish_request' ) ) { |
28 | | - fastcgi_finish_request(); |
29 | | -} elseif ( function_exists( 'litespeed_finish_request' ) ) { |
30 | | - litespeed_finish_request(); |
31 | | -} |
32 | | - |
33 | 21 | if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) { |
| 22 | + if ( ! headers_sent() ) { |
| 23 | + header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); |
| 24 | + header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); |
| 25 | + } |
34 | 26 | die(); |
35 | 27 | } |
36 | 28 |
|
|
46 | 38 | require_once __DIR__ . '/wp-load.php'; |
47 | 39 | } |
48 | 40 |
|
| 41 | +/** This filter is documented in wp-includes/default-constants.php */ |
| 42 | +if ( ! apply_filters( 'wp_cron_endpoint_enabled', true ) ) { |
| 43 | + if ( ! headers_sent() ) { |
| 44 | + header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); |
| 45 | + header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); |
| 46 | + header( 'X-WP-Cron: Bypass' ); |
| 47 | + } |
| 48 | + die(); |
| 49 | +} |
| 50 | + |
| 51 | +if ( ! headers_sent() ) { |
| 52 | + header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); |
| 53 | + header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); |
| 54 | + header( 'X-WP-Cron: Spawned' ); |
| 55 | +} |
| 56 | + |
| 57 | +// Don't run cron until the request finishes, if possible. |
| 58 | +if ( function_exists( 'fastcgi_finish_request' ) ) { |
| 59 | + fastcgi_finish_request(); |
| 60 | +} elseif ( function_exists( 'litespeed_finish_request' ) ) { |
| 61 | + litespeed_finish_request(); |
| 62 | +} |
| 63 | + |
49 | 64 | // Attempt to raise the PHP memory limit for cron event processing. |
50 | 65 | wp_raise_memory_limit( 'cron' ); |
51 | 66 |
|
|
0 commit comments