I believe you are looking for is_tax()
and not has_term()
. has_term()
just basically checks if a post belongs to a given term, while is_tax()
on the otherhand checks whether or not you are on a taxonomy archive page.
So, you can change this code
if ( !has_term('juice', 'types' ) ):
to
if ( !is_tax( 'types', 'juice' ) ):
This simply means that if the current taxonomy archive page is not of the term juice
, do something
Related Posts:
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- Show all terms of a custom taxonomy?
- wp_set_object_terms and arrays
- Show content if parent page has children
- Current post’s author name in the author meta tag
- How to find objects by terms
- Display certain amount of posts on taxonomy archive page
- Conditional statement for parent, child and grandchild pages
- Get used terms by an author as array of strings
- category not display in word press grammatically
- How to get the term before the last from a custom taxonomy?
- List all categories but exclude current post category on single post page
- Trying to use Ternary operators with WP Conditionals
- How do I get taxonomy terms by ID in a specific order
- WP_Query use for a filter with multiple Taxonomies and Terms
- When is is_admin() available?
- Check if current page is wp-admin
- Append a term to WooCommerce product existing product category terms
- Problems with function on function.php
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Check if term object is in array
- How to change / delete product short description in Woocommerce
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- Get taxonomy terms only of the WP_Query current posts
- How to enqueue CSS and JS only on specific template?
- get_the_terms – only top level
- Change description on specific WooCommerce product status change
- get_terms orderby numeric
- Query all posts of a custom taxonomy term
- get_term_link() returns incorrect url
- how could I load a different template part by page
- get_term_link() returns correct – But illogical error-messages disturb
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- get a simple array of all of the term names that exist in all taxonomies
- PHP Warning: Attempt to read property “term_id” on bool
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- How to get original custom taxonomy slug after the slug has been rewritten?
- WordPress, AJAX and pre_get_posts using conditional tags
- Get term siblings of current child taxonomy
- How to get post’s current parent term ID?
- Insert term and child term from frontend
- If tag equals then show else show
- List taxonomy term slugs within shortcode (do_shortcode)
- Include Parent Term in wp_list_categories
- How can I access string value in an array?
- Copy taxonomy terms from one post to another programmatically
- Conditional statement for dates
- Limit Taxonomy Output in Conditional Statement
- Get all categories post is not in
- Hide image if taxonomy term is empty
- Don’t show certain div on front page?
- If ‘editor’ is empty, then
- Add class to DIV depending on page loaded
- Isotope Drop Down Categories Filter Function
- How to filter custom taxonomy term name, slug, and description?
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Hierarchical taxonomy list with modificated term links
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- Exclude product attributes from taxonomy terms loop
- Undefined index for default custom theme option
- Remove conditional tag from header
- Display an image based on field value
- Multidimensional Array
- Create a a form for custom taxonomy terms
- “if parent category is” conditional?
- Conditional for Post Format
- WordPress custom taxonomy
- conditional: if is page, and all subpages
- How to break up php code to avoid echo
- page 1 is not paged
- PHP displaying wrong custom taxonomy images
- Trying to display terms from custom taxonomy within function
- How do I edit the terms output args or array data?
- update_term_meta() only updating once on certain meta keys
- How to retrieve taxonomy Metabox fields in frontend
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Create category after theme setup and modify the default one
- Add code to the header of posts by particular author
- Display specific page if user signed in
- $_GET[‘title’] in WordPress
- wp_set_object_terms returns 500 error when called through AJAX function
- Editing the term_order field
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- New term taxonomy and description in front page. Input’s
- Widget Logic – display on page and all child
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- WordPress using get_term to retreive slug not working as expected
- how to display child terms with parent terms in custom taxonomy?
- How to display terms from two taxonomies in one php code?
- if user is admin display admin link and logout link else display logout only
- Add code only for blog posts
- How to define Og Meta Tags in header using conditions [duplicate]
- If Month=Particular month display content [closed]
- Pass custom value to custom taxonomy
- How to get the count for each taxonomy term
- Get all the contents of taxonomy and sort by term
- How to echo a different field if another field is empty?