woocommerce_blocks_pre_get_routes_from_namespace
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 | Введена. |
Где вызывается хук
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' );