rest_handle_deprecated_argument

Handles _deprecated_argument() errors.

Description

rest_handle_deprecated_argument( (string) $function, (string) $message, (string) $version ); 

Parameters (3)

0. $function (string)
The function that was called.
1. $message (string)
A message regarding the change.
2. $version (string)
The version.

Usage

  1. if ( !function_exists( 'rest_handle_deprecated_argument' ) ) { 
  2. require_once ABSPATH . WPINC . '/rest-api.php'; 
  3.  
  4. // The function that was called. 
  5. $function = ''; 
  6.  
  7. // A message regarding the change. 
  8. $message = ''; 
  9.  
  10. // The version. 
  11. $version = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = rest_handle_deprecated_argument($function, $message, $version); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/rest-api.php  
  1. function rest_handle_deprecated_argument( $function, $message, $version ) { 
  2. if ( ! empty( $message ) ) { 
  3. /** translators: 1: function name, 2: WordPress version number, 3:errormessage */ 
  4. $string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function, $version, $message ); 
  5. } else { 
  6. /** translators: 1: function name, 2: WordPress version number */ 
  7. $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version ); 
  8.  
  9. header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );