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

WC_Products_Tracking::track_categories_and_tags_view() public WC 1.0

Send a Tracks event when the Products Categories and Tags page is viewed.

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

Хуков нет.

Возвращает

Null. Ничего.

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

$WC_Products_Tracking = new WC_Products_Tracking();
$WC_Products_Tracking->track_categories_and_tags_view();

Код WC_Products_Tracking::track_categories_and_tags_view() WC 4.5.2

woocommerce/includes/tracks/events/class-wc-products-tracking.php
<?php
public function track_categories_and_tags_view() {
	// We only record Tracks event when no `_wp_http_referer` query arg is set, since
	// when searching, the request gets sent from the browser twice,
	// once with the `_wp_http_referer` and once without it.
	//
	// Otherwise, we would double-record the view and search events.

	// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification
	if (
		isset( $_GET['post_type'] )
		&& 'product' === wp_unslash( $_GET['post_type'] )
		&& isset( $_GET['taxonomy'] )
		&& ! isset( $_GET['_wp_http_referer'] )
	) {
		$taxonomy = wp_unslash( $_GET['taxonomy'] );
		// phpcs:enable

		if ( 'product_cat' === $taxonomy ) {
			WC_Tracks::record_event( 'categories_view' );
		} elseif ( 'product_tag' === $taxonomy ) {
			WC_Tracks::record_event( 'tags_view' );
		}

		// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification
		if (
			isset( $_GET['s'] )
			&& 0 < strlen( sanitize_text_field( wp_unslash( $_GET['s'] ) ) )
		) {
			// phpcs:enable

			if ( 'product_cat' === $taxonomy ) {
				WC_Tracks::record_event( 'categories_search' );
			} elseif ( 'product_tag' === $taxonomy ) {
				WC_Tracks::record_event( 'tags_search' );
			}
		}
	}
}