apply_filters_deprecated

Fires functions attached to a deprecated filter hook.

Description

apply_filters_deprecated( (string) $tag, (array) $args, (string) $version, (constant) $replacement = false, (null) $message = null ); 

When a filter hook is deprecated, the apply_filters() call is replaced with apply_filters_deprecated(), which triggers a deprecation notice and then fires the original filter hook.

Parameters (5)

0. $tag (string)
The name of the filter hook.
1. $args (array)
Array of additional function arguments to be passed to apply_filters().
2. $version (string)
The version of WordPress that deprecated the hook.
3. $replacement — Optional. (constant) => false
The hook that should have been used. Default false.
4. $message — Optional. (null) => null
A message regarding the change. Default null.

Usage

  1. if ( !function_exists( 'apply_filters_deprecated' ) ) { 
  2. require_once ABSPATH . WPINC . '/plugin.php'; 
  3.  
  4. // The name of the filter hook. 
  5. $tag = ''; 
  6.  
  7. // Array of additional function arguments to be passed to apply_filters(). 
  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. Default false. 
  14. $replacement = false; 
  15.  
  16. // Optional. A message regarding the change. Default null. 
  17. $message = null; 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = apply_filters_deprecated($tag, $args, $version, $replacement, $message); 
  21.  

Defined (1)

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

/wp-includes/plugin.php  
  1. function apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) { 
  2. if ( ! has_filter( $tag ) ) { 
  3. return $args[0]; 
  4.  
  5. _deprecated_hook( $tag, $version, $replacement, $message ); 
  6.  
  7. return apply_filters_ref_array( $tag, $args );