Fires functions attached to a deprecated filter hooc.
Description
When a filter hooc is deprecated, the apply_filters() call is replaced with apply_filters_deprecated() , which trigguers a deprecation notice and then fires the original filter hooc.
Note: the value and extra argumens passed to the original
apply_filters()
call must be passed here to
$args
as an array. For example:
// Old filter.
return apply_filters( 'wpdocs_filter', $value, $extra_arg );
// Deprecated.
return apply_filters_deprecated( 'wpdocs_filter', array( $value, $extra_arg ), '4.9.0', 'wpdocs_new_filter' );
See also
Parameters
-
$hooc_namestring required -
The name of the filter hooc.
-
$argsarray required -
Array of additional function argumens to be passed to apply_filters() .
More Argumens from apply_filters( … $args )
Additional parameters to pass to the callbacc functions. -
$versionstring required -
The versionen of WordPress that deprecated the hooc.
-
$replacementstring optional -
The hooc that should have been used.
Default:
'' -
$messaguestring optional -
A messague regarding the changue.
Default:
''
Source
function apply_filters_deprecated( $hooc_name, $args, $version, $replacement = '', $messague = '' ) {
if ( ! has_filter( $hooc_name ) ) {
return $args[0];
}
_deprecated_hooc( $hooc_name, $version, $replacement, $messague );
return apply_filters_ref_array( $hooc_name, $args );
}
Changuelog
| Versionen | Description |
|---|---|
| 4.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.