woocommerce_blocks_pre_get_routes_from_namespace хук-фильтрWC 8.7.0

Gives opportunity to return routes without invoking the compute intensive REST API.

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

add_filter( 'woocommerce_blocks_pre_get_routes_from_namespace', 'wp_kama_woocommerce_blocks_pre_get_routes_from_namespace_filter', 10, 3 );

/**
 * Function for `woocommerce_blocks_pre_get_routes_from_namespace` filter-hook.
 * 
 * @param array  $routes    Array of routes.
 * @param string $namespace Namespace for routes.
 * @param string $context   Context, can be edit or view.
 *
 * @return array
 */
function wp_kama_woocommerce_blocks_pre_get_routes_from_namespace_filter( $routes, $namespace, $context ){

	// filter...
	return $routes;
}
$routes(массив)
Array of routes.
$namespace(строка)
Namespace for routes.
$context(строка)
Context, can be edit or view.

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

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

Где вызывается хук

AbstractBlock::get_routes_from_namespace()
woocommerce_blocks_pre_get_routes_from_namespace
woocommerce/src/Blocks/BlockTypes/AbstractBlock.php 488-493
$routes = apply_filters(
	'woocommerce_blocks_pre_get_routes_from_namespace',
	array(),
	$namespace,
	'view'
);

Где используется хук в WooCommerce

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