Make WordPress Core

Ticket #41998: 41998.patch

File 41998.patch, 1.4 KB (added by Viper007Bond, 7 years ago)
  • src/wp-includes/default-constants.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    9292                define( 'SCRIPT_DEBUG', $develop_src );
    9393        }
    9494
     95        // Add define( 'WP_DEBUG_REST_API', true ); to wp-config.php to enable pretty JSON in the REST API during development.
     96        if ( ! defined( 'WP_DEBUG_REST_API' ) )
     97                define( 'WP_DEBUG_REST_API', false );
     98
    9599        /**
    96100         * Private
    97101         */
  • src/wp-includes/rest-api/class-wp-rest-server.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    393393                         */
    394394                        $result = apply_filters( 'rest_pre_echo_response', $result, $this, $request );
    395395
    396                         $result = wp_json_encode( $result );
     396                        $options = ( defined( 'WP_DEBUG_REST_API' ) && WP_DEBUG_REST_API ) ? JSON_PRETTY_PRINT : 0;
     397
     398                        $result = wp_json_encode( $result, $options );
    397399
    398400                        $json_error_message = $this->get_json_last_error();
    399401                        if ( $json_error_message ) {