Since you are doing this for a custom taxonomy (solution_cats
), then you should instead use has_term()
and not in_category()
which works only with the default/core category
taxonomy. So try this with your second code:
has_term( $category->slug, $category->taxonomy, get_the_ID() )
is_object_in_term()
can also be used, but your syntax was not correct – the 2nd parameter is actually the term’s taxonomy and not the term ID/name/slug (which should instead be the 3rd parameter).
- The correct syntax:
is_object_in_term(get_the_ID(),$value->taxonomy,$value->term_id)
- But you used this:
is_object_in_term(get_the_ID(),$value->term_id)
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Adding custom post category to categories widget
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Plugin for changing a post’s category based on it’s post date?
- Enable comments for post with comments meta box removed
- Custom Post Type causes Page Not Found
- plugin for wp_list_categories with posts
- Is there a way to order posts and custom post types as one group?
- How can i list random post from multiple category?
- Accessing post’s meta data based on user’s click of a post
- Solutions to repost categories into multisite blogs?
- Calendar Solution: Handling upcoming Dates with Posts?
- get_post_type on post.php
- Any built-in function to associate a post to category through a plugin?
- Matching Chapters to a Custom posts [closed]
- Display by Category in Admin
- How to delete all trashed item in one-go
- Custom setup of wordpress comments that are displayed
- Recent posts per category loop?
- How to set category correctly for a custom post created by a remote API call?
- posts from multiple post types in one slider
- check uncategorized category by default
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- Custom Template for wordpress cpt plugin
- What hook can I use to modify custom post data before it is displayed on the page?
- How to get Recent Post From Each Category with Thumbnail?
- Is it possible to pin a post in second position from top
- Custom Post Type same name as Category
- How to display the category name in the tab and post inside the tab in WordPress?
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- Custom Post Type with Sequence ID
- How to display the custom post related blog by category?
- WordPress hide post from custom post-type on a single page
- automatically set random featured image by category in wordpress on post
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- WordPress list child pages of custom post type
- Find And Add Category to Posts
- Retrieve post thumbnails
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- How to add character to content of post?
- Insert data in custom table during new post creation
- single.php fires more than once after clicking on any post to view with different post id each time
- Twitter List Tweets and Delicious Links as Posts
- Automatically set posts to NoIndex depending on category?
- hide particular category post from front page only [closed]
- Can i have limit posts on a specific category and automatically remove older ones?
- How to export post tags from wordpress
- How to add portfolio category post count in main navigation menu?
- Disable All In One SEO plugin for custom post type
- Tips for using WordPress as a CMS? [closed]
- Restrict access and display for categories
- How to get posts by content?
- WP get_permalink Return Wrong URL
- [Plugin: Posts 2 Posts] reciprocal connections
- post expire after x days
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Display comments of users on single page
- wordpress reusable content blocks
- Post query – show posts from specified day and month and whole years
- Support for simultaneous editing
- Getting a List of Categories for Use in a Plugin?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- View Private Published Page with URL Code (no login required)
- List taxonomy terms for post as checkboxes
- how to add text to posts from tags
- WordPress “Categories to tags converter” not working. Pointing to import.php instead
- Ambrosite Next/Previous Post Link Plus or WP next_post_link to cycle through top level category
- WordPress plugin Post Creation [closed]
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- Custom Post Type – custom form in dashboard
- how to execute some code after a post is published in WordPress [duplicate]
- Restrict category access to specific users/groups. Author always has access
- trigger email when post is published by someone a user follows
- WP-API Custom Post Type json_no_route
- Plugin generated unexpected output – No PHP errors
- Dictionary-style definition list plugin
- Category “same post” retreive and display
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Add a new category for posts
- Create category for each user
- custom post type plugin error [closed]
- Post that populates itself (almost) automatically using data from imported excel file
- Better code/text editing for posts and pages?
- Post Editor: display categories from current post type taxonomy only?
- Calling an custom field from theme option at the frontend
- Style WordPress Custom Post Type Single Page
- WordPress Custom post type won’t save properly
- Using Postmash plugin in WordPress 3.3.1
- Get post id in Post Page within Wp-admin
- Remove base from the custom post type URL [duplicate]
- PHP $_session is not work in wordpress
- Make a Custom template for a specific category in wordpress
- Notifications on WordPress Website [closed]
- show only one category posts in admin
- Looking for membership style plugin with edit option [closed]
- Change from blogger to wordpress
- Create CPT on Ajax Call
- WP galleries in posts after import. How do I do it?
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?
- How can I disable links for categories but keep showing them on my blog in an Elementor Template?