Make WordPress Core


Ignore:
Timestamp:
11/11/2019 03:11:51 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.

Reviewed by johnbillion, youknowriad, SergeyBiryukov.
Props azaozz, mikeschroder, TimothyBlynJacobs, epiqueras, johnbillion, youknowriad.
Merges [46703] to the 5.3 branch.
Fixes #48542.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/script-loader.php

    r46666 r46704  
    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.