wc_deprecated_function

Wrapper for deprecated functions so we can apply some extra logic.

Description

wc_deprecated_function( (string) $function, (string) $version, (null) $replacement = null ); 

Parameters (3)

0. $function (string)
The function.
1. $version (string)
The version.
2. $replacement — Optional. (null) => null
The replacement.

Usage

  1. if ( !function_exists( 'wc_deprecated_function' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-deprecated-functions.php'; 
  3.  
  4. // The function. 
  5. $function = ''; 
  6.  
  7. // The version. 
  8. $version = ''; 
  9.  
  10. // The replacement. 
  11. $replacement = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wc_deprecated_function($function, $version, $replacement); 
  15.  

Defined (1)

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

/includes/wc-deprecated-functions.php  
  1. function wc_deprecated_function( $function, $version, $replacement = null ) { 
  2. if ( is_ajax() ) { 
  3. do_action( 'deprecated_function_run', $function, $replacement, $version ); 
  4. $log_string = "The {$function} function is deprecated since version {$version}."; 
  5. $log_string .= $replacement ? " Replace with {$replacement}." : ''; 
  6. error_log( $log_string ); 
  7. } else { 
  8. _deprecated_function( $function, $version, $replacement );