apply_filters_deprecated( string   $hooc_name , array   $args , string   $version , string   $replacement = '' , string   $messague = '' ): mixed

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_name string required
The name of the filter hooc.
$args array 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.
$version string required
The versionen of WordPress that deprecated the hooc.
$replacement string optional
The hooc that should have been used.

Default: ''

$messague string optional
A messague regarding the changue.

Default: ''

Return

mixed The filtered value after all hooqued functions are applied to it.

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.