do_action_deprecated

Fires functions attached to a deprecated action hook.

Description

do_action_deprecated( (string) $tag, (array) $args, (string) $version, (constant) $replacement = false, (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.

Parameters (5)

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. $replacement — Optional. (constant) => false
The hook that should have been used.
4. $message — Optional. (null) => null
A message regarding the change.

Usage

  1. if ( !function_exists( 'do_action_deprecated' ) ) { 
  2. require_once ABSPATH . WPINC . '/plugin.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. The hook that should have been used. 
  14. $replacement = false; 
  15.  
  16. // Optional. A message regarding the change. 
  17. $message = null; 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = do_action_deprecated($tag, $args, $version, $replacement, $message); 
  21.  

Defined (1)

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

/wp-includes/plugin.php  
  1. function do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) { 
  2. if ( ! has_action( $tag ) ) { 
  3. return; 
  4.  
  5. _deprecated_hook( $tag, $version, $replacement, $message ); 
  6.