Skip to content

Commit

Permalink
Script Loader: In wp_default_packages_inline_scripts(), make sure t…
Browse files Browse the repository at this point in the history
…he 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
  • Loading branch information
SergeyBiryukov committed Nov 11, 2019
1 parent 9fa094e commit 1fceddf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions wp-includes/script-loader.php
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -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.
Expand Down

0 comments on commit 1fceddf

Please sign in to comment.