[wp-trac] [WordPress Trac] #62132: Make wordpress.org API connections for updates, plugins and themes configurable to a different location
WordPress Trac
noreply at wordpress.org
Tue Oct 28 21:08:01 UTC 2025
#62132: Make wordpress.org API connections for updates, plugins and themes
configurable to a different location
--------------------------------------+-----------------------
Reporter: jamesking56 | Owner: (none)
Type: feature request | Status: reopened
Priority: normal | Milestone: 7.0
Component: Upgrade/Install | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------
Comment (by desmith):
After some private discussions, I've completely rewritten this :D
Rather than using a constant, this iteration of the patch adds a core
function, `wp_get_api_request_url()`, used wherever `api.wordpress.org`
previously was hard-coded. This function works like `home_url()`, in that
it takes a path (and optional scheme).
Also added a `wp_api_request` filter, called in the middle of the above,
which would allow you to selectively override (if, say, you wanted to get
plugin/theme updates from one place, but still use .org for news and
docs).
For this iteration, if you want to use a non-default API, the simple way
is probably something like
{{{#!php
<?php
add_filter( 'wp_api_request', 'override_api_dom' );
function override_api_dom ( $url ) {
$origdom = parse_url( $url, PHP_URL_HOST );
return str_replace( $origdom, 'your.mirror.org', $url );
}
}}}
Passes very basic tests but absolutely needs a LOT more testing. Also
needs someone more familiar with all the non-WordPress-itself parts of the
process (basically anything outside the src/ dir) to help with creating
all the appropriate automated tests and so on.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62132#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list