You can try the wp_head hook:
add_action( 'wp_head', 'check_for_enviso_group_ticket' );
function check_for_enviso_group_ticket() {
if ( is_product() && ( 'enviso_group_ticket' == get_the_terms( get_the_ID(), 'product_type' )[0]->slug ) ) {
echo '<meta name="robots" content="noindex,nofollow"/>', PHP_EOL;
}
}
or to not break your site in case the WooCommerce is disabled and the is_product() function isn’t defined:
add_action( 'wp_head', 'check_for_enviso_group_ticket' );
function check_for_enviso_group_ticket() {
if ( is_singular( array( 'product' ) ) && ( 'enviso_group_ticket' == get_the_terms( get_the_ID(), 'product_type' )[0]->slug ) ) {
echo '<meta name="robots" content="noindex,nofollow"/>', PHP_EOL;
}
}
Related Posts:
- NoFollow Entire Website
- Multiple Schema.org markups on a single product page
- Setting up robots.txt with Yoast’s Seo plugin
- WC_Structured_Data Class Causing Needless Translation
- Is it ok to 301 redirect product-category pages to custom pages?
- Will ‘private’ status prevent Woocommerce products to be indexed by search engines?
- Remove filter parameter from Link URL
- Increase load-out-page speed
- Disable Woocommerce main shop page, but not the product category archive pages
- How to edit schema.org markup of WooCommerce?
- Getting the gallery images from products in woocommerce?
- How to add a new endpoint in woocommerce
- Slow Loading Attribute Select – WooCommerce Backend
- How can I define a custom template for woocommerce [products] shortcode? [closed]
- add_filter to modify woocommerce_cart_item_name hyperlink
- Get product details by url key in WordPress woocommerce
- How to get rid of the hover zoom in WooCommerce single products
- How do I display certain products via their category on a section of a page using PHP?
- Display orders instead of woocommerce my account dashboard for logged in users [closed]
- Detect whether a page is a product subcategory page?
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?
- Programmatically change Payment Methods WooCommerce
- Get WooCommerce Email Classes in Backend
- Use Hooks to Limit One Comment Per User Per Post – Hide Form if Already Commented
- Display Categories Assigned to a WooCommerce Product
- pre_get_posts with WooCommerce Shortcode Query
- Get current WooCommerce endpoint not working
- Changing Woocommerce price display [closed]
- Which WooCommerce hook do I need to use to place the coupon field after the checkout sidebar
- Reverse engineering of WooCommerce Storefront filters
- Use WooCommerce function in other WordPress plugin
- How to remove recurring totals information for a particular subscription product? [closed]
- WordPress codex: apply_filters – clarification on creating a new hook on the fly. How do we use it?
- WooCommerce Cart – Group Products By Category
- WooCommerce – update order item price and recalculate totals
- Add product description (content) to WooCommerce customer processing order email
- Set a default quantity input value for a variable product category in WooCommerce
- WooCommerce product sorting VERY slow
- WooCommerce change price in cart [closed]
- Categories not shown in admin after adding woocommerce products via wp wc cli
- Woocommerce – Move product without price a the end
- Enabling autosave when plugin disabled
- WooCommerce email text based on category && shipping zone && payment method [closed]
- woocommerce – get_image_size() deprecated [closed]
- Woocommerce – disable «place order» until user checks Privacy Policy
- Calling calculate_shipping() with ajax in woocommerce
- Adding product SKU before cart item name in WooCommerce
- Accessing parameters when adding filter
- Extra row / text field to a product page (WooCommerce)
- woocommerce_email_attachments filter arguments [closed]
- Problem with cURL and rest API
- Woocommerce: How to remove page title from storefront theme homepage
- Remove checkout fields with Woocommerce depending on one of several shipping methods
- Replace one coupon to another after coupon added
- WooCommerce Multi-Currency shortcode not working
- Filter WooCommerce Orders query with user meta data
- Child theme dosn’t overwrite WooCommerce (version 3.4.7)
- WOOCommerce redirect after registration to account details
- How can I add an additional action button into the woocommerce admin order page?
- Avada & WooCommerce Customization – Replacing product_title in woo-config.php [closed]
- How to unset fields in woocommerce product quick edit?
- rating, share and review issue for single WooCommerce page
- Delete All Product Images in phpmyadmin
- How to add a custom text for order confirmation email template woocommerce
- Blank Pages with # URL & Google
- WooCommerce template page for category
- Custom PLU field in woocommerce email
- I want to get the value of a select attribute in the checkout page, and then use it to show or not the delivery data
- woocomerce is serving OR Relation instead of AND on taxonomy product_tag
- Woocommerce Subscriptions – Set Billing Interval/Period
- WooCommerce with ACF: custom fields per product variation
- Woocommerce checkout page reload on up dating shipping method
- change wp_login url and redirect users at the same time
- How to clear woocommerce checkout form after pageload
- Is there a plugin available for recurring orders in Woocommerce? [closed]
- Woocommerce PHP site that shows table with orders from specific category
- How to get the webshop page in 2:nd language, with Polylang and Hyyan
- Subcategories not working when using shared base with custom taxonomy
- Change how the Subtotal Price in cart being calculated [closed]
- Display Advanced Custom Fields value in Woocommerce admin order details
- Some images aren’t shown on wordpress after installation on host
- How to display text between product thumbnail and CTA button on WooCommerce “Shop” page
- Multiple archive product exist
- Error after woocommerce update from 2.6 to 3.5 [closed]
- Send billing info from woocommerce checkout page to paypal checkout form
- Check if a category has a parent category in WooCommerce REST API
- Remove a higher quantity from stock according to a variation
- Auto generate user email while registration
- WooCommerce Cart Total Table chronology order change [closed]
- Woocommerce Update Order Notes Date
- Shipping Method does not inherit settings from the class
- My woocommerce checkout page and woocommerce setting page are not responding [closed]
- Woocommerce Shortcode custom orderby not working
- Show only one variaton in catalog on meta key
- WordPress & WooCommerce: Localhost, Staging and production environments and how to sync them without losing data
- PayPal Express on product page in WooCommerce – doesn’t seem to work on product page?
- Woocommerce – Want to block a user agent from accessing specific product pages
- Reset all stock status in woocommerce
- How to – proper WordPress 301 redirects?
- Switch position of short description and variations [closed]