woocommerce_locate_template хук-фильтрWC 9.5.0

Filter to customize the path of a given WooCommerce template.

Note: the $default_path argument was added in WooCommerce 9.5.0.

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

add_filter( 'woocommerce_locate_template', 'wp_kama_woocommerce_locate_template_filter', 10, 3 );

/**
 * Function for `woocommerce_locate_template` filter-hook.
 * 
 * @param string $template      Full file path of the template.
 * @param string $template_name Template name.
 * @param string $template_path Default WooCommerce templates path.
 *
 * @return string
 */
function wp_kama_woocommerce_locate_template_filter( $template, $template_name, $template_path ){

	// filter...
	return $template;
}
$template(строка)
Full file path of the template.
$template_name(строка)
Template name.
$template_path(строка)
Default WooCommerce templates path.

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

С версии 9.5.0 Введена.
С версии 9.5.0 $default_path argument added.

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

wc_locate_template()
woocommerce_locate_template
woocommerce/includes/wc-core-functions.php 438
return apply_filters( 'woocommerce_locate_template', $template, $template_name, $template_path, $default_path );

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

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