_monsterinsights_do_action_deprecated

Fires functions attached to a deprecated action hook.

Description

_monsterinsights_do_action_deprecated( (string) $tag, (array) $args, (string) $version, (null) $message = null ); 

When an action hook is deprecated, the do_action() call is replaced with do_action_deprecated(), which triggers a deprecation notice and then fires the original hook. Note, this is a copy of WordPress core's _do_action_deprecated function, that we've copied into MonsterInsights so that we can use it on WordPress versions older than 6.0.0 (when it was introduced to core). If we ever bump our minimum WP version requirements above 6.0.0, we'll remove this function.

Parameters (4)

0. $tag (string)
The name of the action hook.
1. $args (array)
Array of additional function arguments to be passed to do_action().
2. $version (string)
The version of WordPress that deprecated the hook.
3. $message — Optional. (null) => null
A message regarding the change.

Usage

  1. if ( !function_exists( '_monsterinsights_do_action_deprecated' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/deprecated.php'; 
  3.  
  4. // The name of the action hook. 
  5. $tag = ''; 
  6.  
  7. // Array of additional function arguments to be passed to do_action(). 
  8. $args = array(); 
  9.  
  10. // The version of WordPress that deprecated the hook. 
  11. $version = ''; 
  12.  
  13. // Optional. A message regarding the change. 
  14. $message = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = _monsterinsights_do_action_deprecated($tag, $args, $version, $message); 
  18.  

Defined (1)

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

/includes/deprecated.php  
  1. function _monsterinsights_do_action_deprecated( $tag, $args, $version, $message = null ) { 
  2. if ( ! has_action( $tag ) ) { 
  3. return; 
  4.  
  5. _monsterinsights_deprecated_hook( $tag, $version, $message ); 
  6.  
  7. do_action_ref_array( $tag, $args );