Before I start, I must say that your terminology is quite confusing and plain wrong. You should take your time and read through my answer to this question: Is There a Difference Between Taxonomies and Categories?
As I stated before, there is no in_term()
function to check if a post has a specific term. There is however a has_term()
function which accepts the term as first parameter and the taxonomy name as second parameter. So your condition should look like this: (if this is for a specific post type outside the loop)
global $post;
if ( $post->post_type == 'my_post_type' // checks the post type of the post
&& is_single() // Checks if this is a single post
&& has_term( 'term-name or id or slug', 'my_taxonomy', $post->ID ) // Check if post has specific term
) {
// Do something if our condition is true
}
Related Posts:
- wp_enqueue_script adding conditional statement not working
- Check if first paragraph is an image, then show custom code right after it?
- If post author role is X
- Can a conditional statement apply to part of a slug?
- Add default content to posts in a specific category?
- is_front_page, is_page(‘slug’), is_page(id) not working
- Need help on creating If-statement for custom meta fields
- How to make gravatar.com avatars conditional?
- Loading Scripts on Specific Pages
- Condition function for is parent category?
- Conditional Statement – Best Way to Remove Nav on Contact Page
- Proper syntax for simple conditional bloginfo language
- wordpress is_page() problem
- Location-Based Content
- Personalized message for each unique password-protected page
- Conditional Shortcode image display
- Change Woocommerce order button page on particular page
- Change a url / link if a user is logged in?
- to create own conditional tags for business directory in wp
- How to use “Cases” instead of “IFs” for conditional logic
- Which is the better way to write a conditional statement? [closed]
- Nested conditionals
- Is there a way to password-protect part of a post?
- if/Else have_posts Else fails to echo message to page
- Conditonal statement for iPad
- Return function only on certain pages
- How to write this conditional statement?
- Conditional for Custom Post Types
- Date-Based Conditional Tag
- Message box when accessed from iPad
- Show this code if user has previously left a comment
- Insert a conditional in the middle of a function to give it 2 different outcomes
- How can I use ‘edit_form_after_title’ conditionally?
- Force Log in to view a page
- Conditional loading of CSS for my plugin
- Looks like this if condition is not working [closed]
- Generating images from an array of categories
- WP conditional site logo and header block
- How to know if the most recent article
- How to display image on condition that a selection has been made
- How to Conditionally Not Display a Link Based on Current URL?
- Allow users to only CREATE one single (custom) post
- If statement to check for post_content
- why is my custom loop failing?
- Conditional sidebar menu
- What is the best way to disable my WP website if the user has adblocker on? [closed]
- Why isn’t is_page working when I put it in the functions.php file?
- Display navigation menu item conditionally based on user capabilities
- Show content after the first and second paragraph
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Display only certain posts based on visitor’s country?
- Exclude custom function content from certain pages
- How to tell if the user is an admin?
- Function like in_category for custom taxonomies
- Conditions for Users and Visitors
- Custom Menus, Widgets & Conditional Statements
- How to show my sidebar in specific page only?
- WordPress equivalent to Drupal Views? [closed]
- Conditionally load child themes
- Display Footer Shortcode Different for Logged In Users
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- One custom loop with condition to check child posts
- Determine page content based on page parent
- Conditional Tags Based on Previously Viewed Posts
- Conditional based on number of specific custom taxonomy terms in archive.php
- How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?
- Conditional: IF current user has NOT commented on current post (not including post author)
- Display post if a specific tag is present
- Conditional does not work with add_filter
- Dynamic Sidebar Conditional [duplicate]
- Add class to DIV depending on page loaded
- If else with shortcodes
- Using PHP Increment and Conditional Statement to Alternate Loop Background
- Conditional statement not working in function
- How to hide a menu from public, but share content with a private link [closed]
- Condition within single.php to send an email to the post author
- do_action in conditional
- The conditional logic only works to show or hide?
- Conditionally remove comments and post meta in functions.php
- Parse a shortcode differently based on on what it’s nested in
- is_front_page breaks with url parameters generated by a plugin
- Checking for custom field in admin pages
- wp_enqueue_script JS code runs too late (after user begins interacting)
- Conditionally run function based on custom meta value?
- Contact Form 7: conditional logic in e-mail
- Conditional formatting on data fetched from MYSQL
- Find and print first entry from WordPress post in custom excerpt?
- I’m trying to create an if statement that will only display my button link for tickets if its under ‘admission-event’… what is wrong with my code?
- How can I check the rewrite slug of current post type listing page
- Dynamic Content w/ geolocation in WP?
- Restrict content piece by role – Protection message in content?
- Conditional redirect on login using referring URL
- hide/show a div in wordpress
- Multiple domains, Single database, 1 Parent/Master with all content, other domains/slaves with filtered content (based on “location” variable)
- Loading scripts only if a particular shortcode or widget is present
- Conditional required fields for WordPress Contact Form 7
- Issue in If else condition [closed]
- Help with if else statement for separating content from image attachment
- Subpage Conditional
- Display a block conditionally based on user input button