[wp-trac] [WordPress Trac] #41998: REST API: Add debug mode

WordPress Trac noreply at wordpress.org
Sun Sep 11 21:03:39 UTC 2022


#41998: REST API: Add debug mode
--------------------------+--------------------------------
 Reporter:  Viper007Bond  |       Owner:  TimothyBlynJacobs
     Type:  enhancement   |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  rest-api
--------------------------+--------------------------------

Comment (by TimothyBlynJacobs):

 > That said, we usually use rest_ as the prefix, not rest_api_, so let's
 change that for consistency. After that, this looks solid.

 Nice catch. Updated.

 For future readers, a developer could globally enable pretty printing like
 this.

 {{{#!php
 <?php
 add_filter( 'rest_json_encode_options', function ( $options ) {
         $options &= ~JSON_PRETTY_PRINT;

         return $options;
 } );
 }}}

 A developer could disable pretty printing like this.

 {{{#!php
 <?php
 add_filter( 'rest_json_encode_options', function ( $options ) {
         $options &= ~JSON_PRETTY_PRINT;

         return $options;
 } );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41998#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list