Make WordPress Core

Changeset 48150


Ignore:
Timestamp:
06/23/2020 11:02:09 PM (4 years ago)
Author:
whyisjake
Message:

REST API: Ensure depracation errors are called while preloading data with the REST API.

Fixes #50318.

Props dlh, TimothyBlynJacobs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r48110 r48150  
    179179 */
    180180function rest_api_default_filters() {
    181     // Deprecated reporting.
    182     add_action( 'deprecated_function_run', 'rest_handle_deprecated_function', 10, 3 );
    183     add_filter( 'deprecated_function_trigger_error', '__return_false' );
    184     add_action( 'deprecated_argument_run', 'rest_handle_deprecated_argument', 10, 3 );
    185     add_filter( 'deprecated_argument_trigger_error', '__return_false' );
     181    if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
     182        // Deprecated reporting.
     183        add_action( 'deprecated_function_run', 'rest_handle_deprecated_function', 10, 3 );
     184        add_filter( 'deprecated_function_trigger_error', '__return_false' );
     185        add_action( 'deprecated_argument_run', 'rest_handle_deprecated_argument', 10, 3 );
     186        add_filter( 'deprecated_argument_trigger_error', '__return_false' );
     187    }
    186188
    187189    // Default serving.
Note: See TracChangeset for help on using the changeset viewer.