WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Hook::add_filter() public WP 4.7.0

Hooks a function or method to a specific filter action.

{} Это метод класса: WP_Hook{}

Хуков нет.


null. Ничего.


$WP_Hook = new WP_Hook();
$WP_Hook->add_filter( $tag, $function_to_add, $priority, $accepted_args );
$tag(строка) (обязательный)
The name of the filter to hook the $function_to_add callback to.
$function_to_add(callable) (обязательный)
The callback to be run when the filter is applied.
$priority(int) (обязательный)
The order in which the functions associated with a particular action 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 action.
$accepted_args(int) (обязательный)
The number of arguments the function accepts.

Список изменений

С версии 4.7.0 Введена.

Код WP_Hook::add_filter() WP 5.7.2

public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
	$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );

	$priority_existed = isset( $this->callbacks[ $priority ] );

	$this->callbacks[ $priority ][ $idx ] = array(
		'function'      => $function_to_add,
		'accepted_args' => $accepted_args,

	// If we're adding a new priority to the list, put them back in sorted order.
	if ( ! $priority_existed && count( $this->callbacks ) > 1 ) {
		ksort( $this->callbacks, SORT_NUMERIC );

	if ( $this->nesting_level > 0 ) {
		$this->resort_active_iterations( $priority, $priority_existed );