Syntax
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1)
Usage
It is called by themes/plugins, is used to add filters to the queue to be applied to the hook by core.
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;
}