WPDev.one
Core Function
View Source on Trac ↗

add_filter()

add_filter( mixed $hook_name, mixed $callback, mixed $priority = 10, mixed $accepted_args = 1 )

Adds a callback function to a filter hook.

Parameters 3 required

Name / Type Description
$hook_name
string

The name of the filter to add the callback to.

Required
$callback
callable

The callback to be run when the filter is applied.

Required
int

$priority Optional. Used to specify the order in which the functions associated with a particular filter are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the filter. Default 10.

Required
$accepted_args
int

Optional. The number of arguments the function accepts. Default 1.

Return Value

(true)
Always returns true.

Function Information

Since Version
0.71
Source File
wp-includes/plugin.php
Advertisement