Script Loader: In `wp_default_packages_inline_scripts()`, make sure the root URL middleware is registered before using the media middleware.

This allows for requests to retry post-processing large images using the `post-process` REST API endpoint to work as expected.

Props azaozz, mikeschroder, TimothyBlynJacobs, epiqueras, johnbillion, youknowriad.
Fixes #48542.
Built from https://develop.svn.wordpress.org/trunk@46703


git-svn-id: http://core.svn.wordpress.org/trunk@46503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-11-11 15:10:02 +00:00
parent 9fa094ea50
commit 1fceddf46b
2 changed files with 9 additions and 10 deletions

View File

@ -649,6 +649,14 @@ function wp_default_packages_inline_scripts( &$scripts ) {
if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
$scripts->registered['wp-api-fetch']->deps[] = 'wp-hooks';
}
$scripts->add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
esc_url_raw( get_rest_url() )
),
'after'
);
$scripts->add_inline_script(
'wp-api-fetch',
implode(
@ -668,15 +676,6 @@ function wp_default_packages_inline_scripts( &$scripts ) {
),
'after'
);
$scripts->add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
esc_url_raw( get_rest_url() )
),
'after'
);
$scripts->add_inline_script(
'wp-data',
implode(

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-46702';
$wp_version = '5.4-alpha-46703';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.