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
- How to Add Custom Taxonomy To Woocommerce Plugin
- Custom taxonomy not showing up when adding a new custom post type
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Create an archive page for custom taxonomies
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Categories under custom post types doesn’t show properly
- get a list of posts from Custom Taxonomy
- Trying to manage templates on a blog with lots of custom taxonomies
- Display Custom Category (taxonomy) Name in Custom Post Type
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Custom post type and taxonomy permalinks – Structure
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- Custom Post Types relationships
- How many Custom Post Types to register?
- Rewrite WordPress URL to show CPT meta field data
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to bulk copy custom fields between custom posts?
- Custom post type structure for posts with multiple child posts
- Search / Filter posts on Title/Content OR Tags
- Hide parent categories when clicked, and show it’s childs
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Auto Complete Search
- permalink /category/post-name with custom post type and taxonomy
- Displaying Custom Taxonomies From Multiple Custom Post Types
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- Display and register custom categories for custom post types
- Properly flush rewrite rules on plugin activation
- Adding predefined terms to a taxonomy
- Redirect to archive is single post has a certain term assigned to it?
- Custom query – get_the_terms not work
- Custom taxonomy page returns 404
- portfolio custom type tags support
- Custom taxonomies to define versions of a product
- Targeting custom post type via functions.php doesn’t work
- Custom field with Types: get custom field’s value label (of type select)
- Custom taxonomy not saving correctly
- Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
- Custom Post Type Rewrite Throws Headers Sent Errors
- Custom taxonomy does not display in custom post loop
- Create if else for post types in WP_Query ‘post__in’ values
- CPT email notification including only new value custom fields
- Return multiples taxonomies with wp_get_object_terms
- How to add CSS class field in Custom Taxonomy?
- search results to show individual ACF fields from inside custom posts
- Videos Post Type with Custom Filters
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Use output of wp_dropdown_categories($args)
- Values show up in custom home page but not in custom post pages
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Associate custom categories to different user IDs
- archive-{custom_post_type}.php not getting recognized wordpress
- How to retrieve the permalink for a specific (custom) term?
- Values inside a custom field to determine which category posts to display
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Trying to create hierarchy between 3-4 custom post types
- Only One Post of Custom Post Type Appearing on Template Page
- Code to show related posts (custom post type and custom taxonomy/category) is messing with other code
- register_term_meta not working
- Why custom search engine only searches in post titles of custom posts?