WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

WP_Hook::build_preinitialized_hooks() public WP 4.7.0

Normalizes filters set up before WordPress has initialized to WP_Hook objects.

The $filters parameter should be an array keyed by hook name, with values containing either:

  • A WP_Hook instance
  • An array of callbacks keyed by their priorities

Examples:

$filters = array(
	'wp_fatal_error_handler_enabled' => array(
		10 => array(
			array(
				'accepted_args' => 0,
				'function'      => function() {
					return false;
				},
			),
		),
	),
);

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

Хуков нет.

Возвращает

WP_Hook[]. Array of normalized filters.

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

$result = WP_Hook::build_preinitialized_hooks( $filters );
$filters(массив) (обязательный)
Filters to normalize. See documentation above for details.

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

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

Код WP_Hook::build_preinitialized_hooks() WP 5.7.1

<?php
public static function build_preinitialized_hooks( $filters ) {
	/** @var WP_Hook[] $normalized */
	$normalized = array();

	foreach ( $filters as $tag => $callback_groups ) {
		if ( is_object( $callback_groups ) && $callback_groups instanceof WP_Hook ) {
			$normalized[ $tag ] = $callback_groups;
			continue;
		}
		$hook = new WP_Hook();

		// Loop through callback groups.
		foreach ( $callback_groups as $priority => $callbacks ) {

			// Loop through callbacks.
			foreach ( $callbacks as $cb ) {
				$hook->add_filter( $tag, $cb['function'], $priority, $cb['accepted_args'] );
			}
		}
		$normalized[ $tag ] = $hook;
	}
	return $normalized;
}