get_the_terms()
returns FALSE
if there are no terms in the taxonomy, so you could check for that.
$authors = get_the_terms( $post->ID , 'product_author' );
if ( FALSE != $authors ) :
// Do something
endif;
If you want to avoid displaying empty terms, ie. terms that have no objects attached to them, use get_terms()
instead, because you can pass a parameter to filter them:
$terms = get_terms(
array(
'object_ids' => $post->ID,
'taxonomy' => 'product_author',
'hide_empty' => TRUE,
) );
Related Posts:
- How to get WooCommerce Product Category Link by ID?
- Approach for saving a product attribute values with a custom UI in a woocommerce+dokan set up [closed]
- Set download limit and expiry for WooCommerce downloadable products in specific categories
- Remove pagination from WooCommerce product categories on admin edit navigation menus
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- Woocommerce custom taxonomies page
- Outputting an array of term meta values in a custom WooCommerce tab?
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- Get child product categories from parent product category in WooCommerce
- Top level parent taxonomy ID
- Woocommerce product search result layout page
- Filter WooCommerce admin products list by a custom taxonomy
- Woocommerce: How to change the add to cart text in a certain category? [closed]
- Catchable fatal error on custom category post
- Get custom category image from menu
- Hide product categories and taxonomy terms in menu if empty
- Display related products based on 2 specific product attributes values in WooCommerce
- How to target parent product category and its children using WooCommerce?
- woocommerce custom product category template
- Getting WooCommerce product related child categories
- Hiding taxonomies with no children WP_Query & tax_query
- How to display ACF taxonomy checkbox links on WooCommerce product category archive
- Add attribute taxonomy through code don’t appear in admin product page
- Showing custom taxonomy in woocommerce signle product page
- Adding term to a custom taxonomy based on term from product category
- Warning: Undefined variable $post in C:\xampp\htdocs\… after PHP upgrade
- Admin only taxonomies?
- Fill New Taxonomies
- Infinite Scroll appending Next Product Category Term pages
- How to exclude woocommerece product category in search results?
- Cloning product not copying custom taxonomies
- Check if any available product has specific attribute
- how to show product custom taxonomies in woocommerce rest api
- WordPress search form and search result through ACF field in custom taxonomy
- Get user created Woocommerce attributes ( taxonomies ) [closed]
- Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta
- How do you search for a post by custom taxonomy?
- Display woocommerce product_cat child terms with thumbnails
- Woocommerce – how to get and display selected variations on single product page
- How do I check if a post has a term with a particular ancestor/parent?
- Creating a custom archive page for WooCommerce products based on tags
- Hide empty categories on widget
- Order terms by term_order
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Modify Term Update Redirection
- How to get first post in a category of a custom taxonomy
- You are not allowed to manage these items – bug introduced in 4.4
- Get taxonomy name of current post
- How to hide custom taxonomy archives same way as hiding custom post types?
- Custom Fields and performance
- Taxonomy archive template to have conditional logic for displaying child categories
- Set posts_per_page in WP_Query for custom taxonomy
- Redirect to Post List by Taxonomy on User Selection of Taxonomy Dropdown?
- How do I get WordPress URL rewrites into Sitemap?
- How can I allow a custom taxonomy for certain roles?
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- Sorting taxonomy columns by meta value numeric
- Custom taxonomy query not working with switch_to_blog
- How can I check if a taxonomy has more than one item?
- Metabox to list/store a certain type of post tag
- Get Current Custom Taxonomy ID by Post ID
- Get_terms stopped working after WP 4.2
- Show only the grandchildren (using get_terms)
- remove custom taxonomy base / slug [duplicate]
- triple drop down for populating custom taxonomies
- Replace taxonomy permalinks
- Custom Taxonomy Term Archive Page Template that Filters 2 or more Taxonomies
- Front-End Custom Taxonomy Tag Select
- Display all posts that use a custom taxonomy
- Override Taxonomy Template
- Set tax_query conditionally with new WP_Query
- Separate tags with semicolon
- Custom taxonomy terms not showing as list Gutenberg Editor WordPress
- Why does wp_remove_object_terms not work?
- Best way to redirect taxonomy terms to pages
- WordPress cannot find user taxonomies on frontend
- Hide echo of no categories from get_object_taxonomies
- Filter with two id of the same value CPT UI(taxanomies)
- get_terms does not return any results for my custom taxonomy?
- How Can I Remove Child Slug From Grandchild Slug When Using Duplicate Grandchild Slugs?
- How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?
- Create multiple taxonomies with custom fields values on the fly when creating new posts
- Custom Taxonomies Archive Page 404
- How to replace custom post type with custom taxonmy in permalinks
- deleted_$taxonomy not getting fired
- Custom column into custom taxonomy (img tag with slug-name as file name)
- ACF Custom field not showing in Timber Taxonomy page
- Displaying subcategories and then posts in taxonomy template
- WP Query : strange behaviour with multiple no-hierarchical tax
- How to set “manage categories” capabilities on a post type taxonomy but not on the general categories?
- Dynamic drop down of child terms and then drop down posts
- Include attachments with a custom taxonomy in search
- List terms and order by second word
- If term and page have the same slug, how can I view the term archive?
- add custom fields in custom taxonomy meta box in wordpress-3.5.2
- How to permanently delete a taxonomy
- How to query posts that are not related to any term of a taxonomy?
- add_action with variable as a part of the $tag string
- How to add a custom page template selector to a custom taxonomy?
- How to display Custom taxonomy on custom post listing page [duplicate]