Make WordPress Core

Changeset 46703


Ignore:
Timestamp:
11/11/2019 03:08:43 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r46664 r46703  
    652652    $scripts->add_inline_script(
    653653        'wp-api-fetch',
     654        sprintf(
     655            'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
     656            esc_url_raw( get_rest_url() )
     657        ),
     658        'after'
     659    );
     660    $scripts->add_inline_script(
     661        'wp-api-fetch',
    654662        implode(
    655663            "\n",
     
    669677        'after'
    670678    );
    671     $scripts->add_inline_script(
    672         'wp-api-fetch',
    673         sprintf(
    674             'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
    675             esc_url_raw( get_rest_url() )
    676         ),
    677         'after'
    678     );
    679 
    680679    $scripts->add_inline_script(
    681680        'wp-data',
Note: See TracChangeset for help on using the changeset viewer.