[wp-trac] [WordPress Trac] #64157: Introduce constant or filter to prevent wp-cron.php triggering cron jobs.
WordPress Trac
noreply at wordpress.org
Tue Oct 28 01:15:36 UTC 2025
#64157: Introduce constant or filter to prevent wp-cron.php triggering cron jobs.
---------------------------+-----------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version:
Severity: normal | Keywords:
Focuses: performance |
---------------------------+-----------------------------
The constant `DISABLE_WP_CRON` allows developers to
[https://developer.wordpress.org/apis/wp-config-php/#disable-cron-and-
cron-timeout prevent the triggering of loopback requests] to the `wp-
cron.php` endpoint.
However, the constant does not prevent the `wp-cront.php` endpoint from
running events registered via the WP Cron API.
`DISABLE_WP_CRON` was introduced prior to the existence of WP-CLI, so the
recommended method for executing jobs via real cron was to execute the
script directly or use curl to call the endpoint.
Now that WP CLI does exist, the best method for running wp-cron via real
cron is to call `wp cron event run --due-now` or similar.
With this new best practice, I think it would be beneficial to allow
developers to disable the wp-cron.php endpoint. Hitting the endpoint can
be resource intensive and, for sites using real cron, lead to conflicts.
I think a constant or filter `disable_wp_cron_endpoint` would be
beneficial in the context of modern sites using WP CLI.
The value of `DISABLE_WP_CRON` would need to default to the new
filter/constant as firing loopback requests to an endpoint that doesn't do
anything would be a little bit silly.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64157>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list