wc_do_deprecated_action

Runs a deprecated action with notice only if used.

Description

wc_do_deprecated_action( (string) $action, (array) $args, (string) $deprecated_in, (string) $replacement ); 

Parameters (4)

0. $action (string)
The action.
1. $args (array)
The args.
2. $deprecated_in (string)
The deprecated in.
3. $replacement (string)
The replacement.

Usage

  1. if ( !function_exists( 'wc_do_deprecated_action' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-deprecated-functions.php'; 
  3.  
  4. // The action. 
  5. $action = ''; 
  6.  
  7. // The args. 
  8. $args = array(); 
  9.  
  10. // The deprecated in. 
  11. $deprecated_in = ''; 
  12.  
  13. // The replacement. 
  14. $replacement = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wc_do_deprecated_action($action, $args, $deprecated_in, $replacement); 
  18.  

Defined (1)

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

/includes/wc-deprecated-functions.php  
  1. function wc_do_deprecated_action( $action, $args, $deprecated_in, $replacement ) { 
  2. if ( has_action( $action ) ) { 
  3. wc_deprecated_function( 'Action: ' . $action, $deprecated_in, $replacement ); 
  4. do_action_ref_array( $action, $args );