Changeset 48361 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 07/07/2020 04:59:51 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r48357 r48361 185 185 add_action( 'deprecated_argument_run', 'rest_handle_deprecated_argument', 10, 3 ); 186 186 add_filter( 'deprecated_argument_trigger_error', '__return_false' ); 187 add_action( 'doing_it_wrong_run', 'rest_handle_doing_it_wrong', 10, 3 ); 188 add_filter( 'doing_it_wrong_trigger_error', '__return_false' ); 187 189 } 188 190 … … 596 598 597 599 header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) ); 600 } 601 602 /** 603 * Handles _doing_it_wrong errors. 604 * 605 * @since 5.5.0 606 * 607 * @param string $function The function that was called. 608 * @param string $message A message explaining what has been done incorrectly. 609 * @param string|null $version The version of WordPress where the message was added. 610 */ 611 function rest_handle_doing_it_wrong( $function, $message, $version ) { 612 if ( ! WP_DEBUG || headers_sent() ) { 613 return; 614 } 615 616 if ( is_null( $version ) ) { 617 /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message */ 618 $string = __( '%1$s (%2$s)' ); 619 $string = sprintf( $string, $function, $message ); 620 } else { 621 /* translators: Developer debugging message. 1: PHP function name, 2: Version information message, 3: Explanatory message. */ 622 $string = __( '%1$s (since %2$s; %3$s)' ); 623 $string = sprintf( $string, $function, $version, $message ); 624 } 625 626 header( sprintf( 'X-WP-DoingItWrong: %s', $string ) ); 598 627 } 599 628
Note: See TracChangeset
for help on using the changeset viewer.