rest_handle_deprecated_function() WordPress Function
The rest_handle_deprecated_function() function is used to handle deprecated WordPress REST API functions. This function is called by the deprecated_function() function. The function takes two arguments: the function name and an array of replacement functions. The deprecated function is called with the first function in the replacement array. If that function is not callable, the next function in the array is called, and so on. If no replacement function is callable, or if the replacement function does not return a WP_REST_Response object, then a WP_Error object is returned.
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: 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 ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |