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

Handles _deprecated_function() errors.


Parameters

$function

(string) (Required) The function that was called.

$replacement

(string) (Required) The function that should have been called.

$version

(string) (Required) Version.


Source

File: wp-includes/rest-api.php

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

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


Changelog

Changelog
Version Description
WP-4.4.0 Introduced.