WC_Products_Tracking::get_product_screen
Adds the tracking scripts for product filtering actions.
Метод класса: WC_Products_Tracking{}
Хуков нет.
Возвращает
Строку|true|false.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_product_screen( $hook );
- $hook(строка) (обязательный)
- Hook of the current page.
Код WC_Products_Tracking::get_product_screen() WC Products Tracking::get product screen WC 10.9.4
protected function get_product_screen( $hook ) {
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification
if (
'edit.php' === $hook &&
isset( $_GET['post_type'] ) &&
'product' === wp_unslash( $_GET['post_type'] )
) {
return 'list';
}
if (
'post-new.php' === $hook &&
isset( $_GET['post_type'] ) &&
'product' === wp_unslash( $_GET['post_type'] )
) {
return 'new';
}
if (
'post.php' === $hook &&
isset( $_GET['post'] ) &&
'product' === get_post_type( intval( $_GET['post'] ) )
) {
return 'edit';
}
if ( 'product_page_product_importer' === $hook ) {
return 'import';
}
// phpcs:enable
return false;
}