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

WP_Hook::apply_filters() public WP 4.7.0

Calls the callback functions that have been added to a filter hook.

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

Хуков нет.

Возвращает

Разное. The filtered value after all hooked functions are applied to it.

Использование

$WP_Hook = new WP_Hook();
$WP_Hook->apply_filters( $value, $args );
$value(смешанный) (обязательный)
The value to filter.
$args(массив) (обязательный)
Additional parameters to pass to the callback functions. This array is expected to include $value at index 0.

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

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

Код WP_Hook::apply_filters() WP 5.5.1

wp-includes/class-wp-hook.php
<?php
public function apply_filters( $value, $args ) {
	if ( ! $this->callbacks ) {
		return $value;
	}

	$nesting_level = $this->nesting_level++;

	$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
	$num_args                           = count( $args );

	do {
		$this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
		$priority                                 = $this->current_priority[ $nesting_level ];

		foreach ( $this->callbacks[ $priority ] as $the_ ) {
			if ( ! $this->doing_action ) {
				$args[0] = $value;
			}

			// Avoid the array_slice() if possible.
			if ( 0 == $the_['accepted_args'] ) {
				$value = call_user_func( $the_['function'] );
			} elseif ( $the_['accepted_args'] >= $num_args ) {
				$value = call_user_func_array( $the_['function'], $args );
			} else {
				$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
			}
		}
	} while ( false !== next( $this->iterations[ $nesting_level ] ) );

	unset( $this->iterations[ $nesting_level ] );
	unset( $this->current_priority[ $nesting_level ] );

	$this->nesting_level--;

	return $value;
}