Syntax
apply_filters(string $tag, mixed $value)
Usage
This is a callback function that has to been added to a filter hook. The callback functions attached to the filter hook are invoked by calling this function. apply_filters() function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter.
Add this below code in wp-includes/plugin.php.
function apply_filters( $tag, $value ) {
global $wp_filter, $wp_current_filter;
$args = func_get_args();
if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
_wp_call_all_hook( $args );
}
if ( ! isset( $wp_filter[ $tag ] ) ) {
if ( isset( $wp_filter['all'] ) ) {
array_pop( $wp_current_filter );
}
return $value;
}
if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
}
array_shift( $args );
$filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );
array_pop( $wp_current_filter );
return $filtered;
}