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.

Reviewed by johnbillion, youknowriad, SergeyBiryukov.
Props azaozz, mikeschroder, TimothyBlynJacobs, epiqueras, johnbillion, youknowriad.
Merges [46703] to the 5.3 branch.
Fixes #48542.
Built from https://develop.svn.wordpress.org/branches/5.3@46704


git-svn-id: http://core.svn.wordpress.org/branches/5.3@46504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-11-11 15:13:02 +00:00
parent a4ea358a27
commit 0dcfbcca36
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'] ) ) { if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
$scripts->registered['wp-api-fetch']->deps[] = 'wp-hooks'; $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( $scripts->add_inline_script(
'wp-api-fetch', 'wp-api-fetch',
implode( implode(
@ -668,15 +676,6 @@ function wp_default_packages_inline_scripts( &$scripts ) {
), ),
'after' '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( $scripts->add_inline_script(
'wp-data', 'wp-data',
implode( implode(

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-RC4-46699'; $wp_version = '5.3-RC4-46704';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.