-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Introduce the wp_get_api_hostname() function
#8343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
…bility to more easily set up local mirrors of the WordPress API.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
… default endpoint for API requests.
… to always using HTTPS.
…ite Health check, preventing a deprecation warning from being thrown if a scheme is not included
…rue` where the HTTP scheme was previously used in core for now.
|
This looks great @Clorith. |
|
Any chance of getting this commited for 6.8? The beta period upon us. |
|
@Clorith @SergeyBiryukov this is looking nice! What remains to be done here? Happy to help! |
The
wp_get_api_hostname()function would allow hosters the ability to more easily set up local mirrors of the WordPress API.This pull request summarizes some of the work already put into the ticket, and feedback from other communication platforms, so that all ideas are brought forth.
It introduces a new function,
wp_get_api_hostname(), this is very directly named, as it relates to the base hostname used for API requests, and we wish to ensure its self evident what the intent of the function is.It allows a hoster to define a
WP_API_HOSTNAMEenvironment variable, to pre-empt any installation steps, ensuring all requests are passed through their mirror from start to finish in the WP journey if need be.It is also possible for a site to define the
WP_API_HOSTNAMEconstant in theirwp-config.phpfile, if they wish to diverge from the hosters predefined expectations.And finally, there's the
wp_api_hostnamefilter, for more fine grained control. Currently it does not pass any contexts, but it is easier to add to a filter later, than to take away from it, so this is a nice starting point for an initial implementation I think.For more fine grained filtering control, the filters found within the WordPress HTTP API are better suited, but are not available to a site early enough in the flow to be usable for example during setup.
I've also simplified the Site Health outputs, instead of introducing extra checks, re-labeling the reference to "api.wordpress.org" to "the WordPress API" does the same, and by adding a field in the debug data section to reference what API host is returned, the information is still readily available if someone needs to look it up.
Trac ticket: https://core.trac.wordpress.org/ticket/62132
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.