-
Notifications
You must be signed in to change notification settings - Fork 4.8k
RTC: Use SHORTINIT for polling provider endpoint #77065
Description
WordPress has a SHORTINIT constant that skips loading a lot of the WordPress core functionality.
Then if the SHORTINIT constant is defined, and set, it will stop the rest of WordPress being loaded. This is handy if you need to create custom requests which only need the core WordPress functionality, but not things like custom post types or custom taxonomies.
The endpoint would probably need to selectively load some parts of WordPress, but it would still be much more efficient.
Opus 4.6 on the possibility of using SHORTINIT for RTC sync endpoints:
Yes, it could work and would yield meaningful latency/memory savings, but it requires: (1) a new standalone PHP entry point, (2) replacing all WP_REST_* dependencies with manual request/response handling, (3) selectively loading the auth stack, and (4) rewriting storage to use only $wpdb instead of get_posts()/wp_insert_post(). The JS client change is small (point apiFetch at a new URL).