[wp-trac] [WordPress Trac] #63858: Trigger the wp_cron action from the shutdown hook instead of the init hook to reduce TTFB (⏱️ Time To First Byte) and improve performance 📈
WordPress Trac
noreply at wordpress.org
Thu Oct 9 21:30:05 UTC 2025
#63858: Trigger the wp_cron action from the shutdown hook instead of the init hook
to reduce TTFB (⏱️ Time To First Byte) and improve performance 📈
----------------------------------------------------+---------------------
Reporter: pmbaldha | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.9
Component: Cron API | Version: 2.1
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-dev-note | Focuses:
----------------------------------------------------+---------------------
Changes (by peterwilsoncc):
* keywords: has-patch needs-testing => has-patch needs-testing needs-dev-
note
Comment:
@westonruter I've been considering this and think it could be worth trying
if committed prior to the first beta release. It would be good to have a
dev note published around the same time with a call out for testing.
Currently, the cron loopback request fires on the `wp_loaded` hook in the
function `_wp_cron()`. `wp_cron` fires on the `init` hook and registers
the loopback request to fire later. [https://github.com/WordPress
/wordpress-develop/blob/ab52706cb23c11a5e784219420c779a55a474c0b/src/wp-
includes/cron.php#L993-L999 See the source code].
The wrapper function was added in WordPress 5.7.0 to maintain backward
compatibility for plugins running `remove_action( 'init', 'wp_cron' )`.
In this case, I think changing the hook used in `wp_cron` is adequate.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63858#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list