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?
- WooCommerce: How to edit the get_price_html
- Get woocommerce product price by id [closed]
- Woocommerce: How to remove page-title at the home/shop page but not category pages
- Hidden woocommerce products still showing up in search results [closed]
- Preventing WooCommerce email sending only on particular conditions
- Woocommerce view order link in customer emails
- Filter on a custom product attribute in WooCommerce using meta_query or tax_query [closed]
- Is is safe to edit language files from wp-content/languages/plugins/woocommerce-ro_RO?
- Does the woocommerce_order_status_changed hook fire when WooCommerce updates an order status automatically? [closed]
- Display WooCommerce only in stock sizes product attribute on shop page
- Remove “Choose An Option” on Product Variation & Auto Select Instead
- check if current url/page equals checkout page [closed]
- Mini cart in header using divi is not getting updated on changing the cart items count:
- Woocommerce Product Price Inserted programmatically doesn’t get displayed In Single Product Page
- How to Order by random on a SQL query
- Move add to cart in Woocommerce
- Separate Categories from WC Product loop when display type is set to both on the category
- Remove Order List Row Link in WooCommerce Admin?
- How do I hide out of stock products from homepage but not from catalog?
- Woocommerce order processing email subject not changing
- Different translations for the same plugin inside a multisite
- Woocommerce multiple taxes with same rates adds as different values.
- function to add note on single Woo Commerce product page for downloadable variations
- Woocommerce Porto Theme Hide Selected Categroy for Breadcrumbs
- Set specific number of columns for top level term on product category archives
- invalid menu item when upgrading to WordPress 5.5
- Register a new user on wooCommerce using Rest API
- Woocommerce custom search
- How to be able to edit custom address fields in WooCommerce admin?
- Make a Read More toggle in the_content on single-product in Woocoomerce
- WooCommerce Base Page Featured Image Custom Theme
- Adding extra email address who receives email like admin – woocommerce
- Is it possible to merge Woocommerce attributes? [closed]
- How can i create a custom product search?
- *Woocommerce* Past Orders Disappeared after changing Stripe Account [closed]
- Need help in handling woocommerce api timeout issue [closed]
- How to display the percentage of the applied tax in woocommerce [closed]
- Remove link from product attributes in tab “additional information” [closed]
- Merging updated dev site with live site while keeping orders correct
- Hide inventory message on product page based on available stock quantity
- Different Templates for Woocommerce Parent and Child Sub Categories
- how can i add an additional action into woocommerce admin order page through my plugin?
- Woocommerce changing add to cart button text as icon [closed]
- Remove sale signs from site in branded? [closed]
- Create a regular post for every WooCommerce order
- How do I create a filter to hide the One Click Accessibility plugin button in WordPress?
- customers are not showing up in woocommerce
- Hooks For Design variation in woo commerce single product page
- Dokan stock management
- Access custom meta_data in processing order email
- Woocommerce : How to automatically input the same email for every order?
- Woocommerce – Change order of products in Confirmed Order
- echo product parent category
- How to edit wc_get_template_part for archive products
- Switch to user link shortcode
- Woocommerce – how to round up all prices to end in .99
- Shop Category Pages missing s
- Display WooCommerce product attribute on shop page
- How to get product category ID based on post?
- Jump to Footer On Scroll – Woocommerce Pages Phones Only
- WordPress Development Workflow
- Remove Stripe Woocommerce Credit Card Icons (and replace with image)
- How to add external product url to woocommerce from a metadata by function.php
- Unable to call woocommerce hook in my custom php file
- Custom account page that accepts a query parameter
- Custom WooCommerce template for product
- Checkout fr Woocommerce – load default WooCommerce checkout template on the fly
- Loop Through Current Woocommerce Product Categories Sub Categories
- Two types of product categories on shop page
- How to send an automatic email to a custom field in Woocommerce order meta 2 weeks after a product is bought
- Woocommerce cart table too wide [closed]
- HTTP Error when uploading pictures and problem with the size of images
- add_rewrite_rule() returns 404 page
- Custom changes performed on WP + WooCom site on maintenance subdomain. How to perform a migration to a main domain?
- Woocommerce Setup not completing
- WooCommerce – Adding Product Attributes to CSV Export
- Unable to enocde the result of wc_get_products
- Woocommerce Add to Cart function
- WooCommerce – doesn’t show product when using woocommerce.php [closed]
- How to show woocommerce login / registration form in modal
- Notice: Trying to get property of non-object in bodycenter [closed]
- WooCommerce remove billing detail completly
- Woocommerce – display all sold out products
- Woocommerce how to show most selling products by category
- AffiliateWP not calculating multiple quantities when using affwp_calc_referral_amount filter
- Hide a shipping method if cart total is higher than an amount
- What purpose does /embed/ URL have and how to avoid SEO problems?
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- How to update all products with same SKU prefixes when updating stock with CSV?
- What is the best and cheapest way to generate dashboards about conversions data and store users? [closed]