Skip to content

Commit 0a06f41

Browse files
committed
Fixed rest_handle_doing_it_wrong to manage debug messages properly - part 2
1 parent 117af7e commit 0a06f41

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/wp-includes/rest-api.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ function rest_handle_deprecated_argument( $function_name, $message, $version ) {
767767
* @param string|null $version The version of WordPress where the message was added.
768768
*/
769769
function rest_handle_doing_it_wrong( $function_name, $message, $version ) {
770-
if ( ! WP_DEBUG || headers_sent() ) {
770+
if ( ! WP_DEBUG ) {
771771
return;
772772
}
773773

@@ -781,7 +781,15 @@ function rest_handle_doing_it_wrong( $function_name, $message, $version ) {
781781
$string = sprintf( $string, $function_name, $message );
782782
}
783783

784-
header( sprintf( 'X-WP-DoingItWrong: %s', $string ) );
784+
if ( WP_DEBUG_LOG ) {
785+
error_log(
786+
sprintf(
787+
'REST API - Function %1$s was called incorrectly. %2$s',
788+
$function_name,
789+
wp_strip_all_tags( $message )
790+
)
791+
);
792+
}
785793
}
786794

787795
/**

0 commit comments

Comments
 (0)