Make WordPress Core


Ignore:
Timestamp:
06/22/2021 09:20:44 PM (3 years ago)
Author:
iandunn
Message:

Block Editor: Send locale, version with remote pattern requests.

This information is needed by the w.org API for translation and caching.

Props dd32, ryelle, tellyworth
See #53435

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php

    r51093 r51206  
    8484     */
    8585    public function get_items( $request ) {
    86         $query_args  = array();
     86        /*
     87         * Include an unmodified `$wp_version`, so the API can craft a response that's tailored to
     88         * it. Some plugins modify the version in a misguided attempt to improve security by
     89         * obscuring the version, which can cause invalid requests.
     90         */
     91        require ABSPATH . WPINC . '/version.php';
     92
     93        $query_args = array(
     94            'locale'     => get_user_locale(),
     95            'wp-version' => $wp_version,
     96        );
     97
    8798        $category_id = $request['category'];
    8899        $keyword_id  = $request['keyword'];
Note: See TracChangeset for help on using the changeset viewer.