rest_handle_deprecated_function( string $function_name, string $replacement, string $version )

In this article

Handles _deprecated_function() errors.

Parameters

$function_namestringrequired
The function that was called.
$replacementstringrequired
The function that should have been called.
$versionstringrequired
Version.

Source

function rest_handle_deprecated_function( $function_name, $replacement, $version ) {
	if ( ! WP_DEBUG || headers_sent() ) {
		return;
	}
	if ( ! empty( $replacement ) ) {
		/* translators: 1: Function name, 2: WordPress version number, 3: New function name. */
		$string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function_name, $version, $replacement );
	} else {
		/* translators: 1: Function name, 2: WordPress version number. */
		$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function_name, $version );
	}

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

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

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