
WordPress offers a filter hooks to allow the plugins to modify various types of internal data at run time. It hook a function or method to a specific filter action and then call the functions added to a filter hook. Here we are going to explain you about the difference between Add_Filter and Apply_Filters.
add_filter()
It hooks a function or method to a specific filter action.
add_filter() has the following basic syntax:
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
where;
$tag: It specifies the name of the action to which the $function_to_add is hooked.
$function_to_add: It specifies the callback to be run when the filter is applied.
$priority: It specifies the order in which the functions associated with a particular action are executed.
$accepted_args: It specifies the number of arguments the function accepts.
Example

apply_filters()
It call the functions added to a filter hook.
apply_filters() has the following basic syntax:
apply_filters( string $tag, mixed $value )
where;
$tag: It specifies the name of the filter hook.
$value: It specifies the value on which the filters hooked to $tag are applied on.
$var: It specifies the additional variables passed to the functions hooked to $tag.
Example
