WC_Products_Tracking::get_product_screen()
Adds the tracking scripts for product filtering actions.
Method of the class: WC_Products_Tracking{}
No Hooks.
Return
String|true|false
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_product_screen( $hook );
- $hook(string) (required)
- Hook of the current page.
WC_Products_Tracking::get_product_screen() WC Products Tracking::get product screen code WC 7.7.0
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; }