A WordPress-centric search engine for devs and theme authors



rest_handle_deprecated_function ›

Since4.4.0
Deprecatedn/a
rest_handle_deprecated_function ( $function, $replacement, $version )
Parameters: (3)
  • (string) $function The function that was called.
    Required: Yes
  • (string) $replacement The function that should have been called.
    Required: Yes
  • (string) $version Version.
    Required: Yes
Defined at:
Codex:

Handles _deprecated_function() errors.



Source

function rest_handle_deprecated_function( $function, $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, $version, $replacement );
	} else {
		/* translators: 1: function name, 2: WordPress version number */
		$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
	}

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