Instead of is_tax(), which
Determines whether the query is for an existing custom taxonomy
archive page.
you should use has_term(),
Check if the current post has any of given terms.
Like so,
if ( has_term( 'booked', 'room_vacancy', $post_object ) ) {
// Yay!
}
Related Posts:
- Getting custom taxonomy from custom post type
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- get terms that have post with custom post type between 2 values
- Show ACF field from custom taxonomy and display on the single template
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Linking three taxonomies with ACF
- Get Custom Field Values by Another Custom Field in WordPress
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Create 3 Level Relations with ACF and WordPress
- get_posts of Custom Post Type AND Custom Taxonomy
- Retrieve value of a category’s custom field
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- Query Custom Post Type Taxonomy term with multiple parameters
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- How to group posts and get a mixed posts and groups view?
- How to define the template for custom posts?
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- ACF – Retrieve custom taxonomy from a relationship field
- Custom front-end form for adding post – Category problem
- Create loop from selected terms in ACF taxonomy field
- Sort custom posts by date and then by taxonomy
- Display Custom Field or Custom Taxonomy in front page /post/product
- WP_Query not using custom taxonomy categories on custom post type
- Some posts not displaying by taxonomy term
- Taxonomy shows up twice on Custom Post Type
- How to display custom post type pagination buttons when processing AJAX request
- Display custom tax in “while” loop
- Best way to have one product in both rental and sale parent category
- How to query posts by meta keys AND under specific category?
- How to query the content of a specific custom post type?
- Advanced Custom Fields: query posts filtered by multiple field values
- ACF Relationship: Group posts by parent category term, then child [closed]
- Custom taxonomy meta fields
- Custom Sort Order for Custom Post Type Taxonomy
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- Custom fields disappearing when a custom post type is assigned
- Custom Post Type Permalink / Rewrite not working immediately
- has_term or in_category for Custom Post Types
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- Correct way to use a form to to filter custom posts by taxonomy terms?
- Custom-Taxonomy as categories: Remove “most-used” tab?
- Custom Permalinks for Custom Post Types and Taxonomies
- how to group custom post type posts by custom taxonomy terms
- Showing current taxonomy terms
- Unable to save custom taxonomy terms in a custom-built metabox
- Custom Taxonomy order by Custom Field
- Display custom post type in hierarchical order with get_terms
- Am unable to reset a query properly
- Custom Post Type permalink shows wrong page: homepage/index.php
- using $wpdb to get custom post type with term
- Display Custom Toxonomy In WordPress and theme Widgets category selection dropdown list
- Custom Post Type Pagination Paginates Only in URL Structure
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Hierarchial Custom Post Types/Taxonomies
- Hierarchical permalinks for custom post type and taxonomy
- Adavnced custom fields relationship query plus query inside
- Different Category system needed for the Custom Post Type
- single-{post_type}.php not working
- WordPress wp_query() basic question about args
- How to add current custom taxonomy slug to body class
- How to define a term for custom taxonomy
- Exclude posts with custom taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- Dynamic CPT / Taxonomy
- How to approach a site where it has sub-businesses, each with its own pages (“articles”, “staff”)? Don’t want to use WP multisite
- Get custom term meta problem on single post type
- Creating custom post type posts and associating them with a post from another custom post type
- meta query not retrieving posts
- Custom Post Type View Button in Admin Gives 400 Error
- Custom Taxonomy Filter Issues
- how to organize my categories or should I do custom post types for some?
- How do i display post from a taxonomy term?
- Multiple permalinks for a single post with multiple taxonomies
- rewrite rules hierarchical
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Archive page of taxonomy returns a 404 error
- update custom taxonomy custom fields
- Filter posts by their related field’s custom field
- How to display “META” array in register_taxonomy
- Permalink URL connection between two custom types
- Change Search display for Custom Post Type
- WooCommerce – Custom related product (Spareparts)
- Custom category taxonomy – archive page not showing up
- Custom post type option page template
- tax_query not working?
- I want to display my custom post type arranged by taxonomy
- Connect 8 Taxonomies to One (Main) taxonomy. How to?
- Pods pagination erases my sub menu
- How to have permalink structure based on taxonomy terms
- Checking Taxonomy Terms for a Custom Post Type With get_the_terms Not Working
- Get posts that have custom post type value
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- Permalink for Custom Post Types
- Function not working on live server but every thing is fine on localhost
- How to change custom post type slug without damage seo? [closed]
- Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected
- How to automatically compare date from custom post type with current date and change taxonomy based on a result?
- How to add capability to author role to assign custom taxonomy terms to a custom post type?
- Is it possible to get_terms by taxonomy AND post_type?