Make WordPress Core

Ticket #50318: 50318.diff

File 50318.diff, 1.1 KB (added by dlh, 4 years ago)
  • src/wp-includes/rest-api.php

    diff --git src/wp-includes/rest-api.php src/wp-includes/rest-api.php
    index e408522ab6..799c871b1a 100644
    function rest_api_register_rewrites() { 
    178178 * @since 4.4.0
    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.
    188190        add_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );