rest_handle_doing_it_wrong( string $function_name, string $message, string|null $version )

In this article

Handles _doing_it_wrong errors.

Parameters

$function_namestringrequired
The function that was called.
$messagestringrequired
A message explaining what has been done incorrectly.
$versionstring|nullrequired
The version of WordPress where the message was added.

Source

function rest_handle_doing_it_wrong( $function_name, $message, $version ) {
	if ( ! WP_DEBUG || headers_sent() ) {
		return;
	}

	if ( $version ) {
		/* translators: Developer debugging message. 1: PHP function name, 2: WordPress version number, 3: Explanatory message. */
		$string = __( '%1$s (since %2$s; %3$s)' );
		$string = sprintf( $string, $function_name, $version, $message );
	} else {
		/* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message. */
		$string = __( '%1$s (%2$s)' );
		$string = sprintf( $string, $function_name, $message );
	}

	header( sprintf( 'X-WP-DoingItWrong: %s', $string ) );
}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.