It looks like you’re mixing the WordPress in_category() function with plugin / theme code that isn’t setting up a standard WP Query or post object. So you can’t use in_category().
Use var_dump($content);
and var_dump($data);
to see if either of those objects have a ‘category’ property for the content. Use that in an if statement instead, e.g.: if($data->category-id == 26)
Related Posts:
- Exclude category on blog list page
- How can I remove posts of a certain category from homepage after a specified time period?
- How to filter posts that belong to a specific category only if that is the only category
- Widget that shows categories with posts numbers
- wp_list_categories() Exclude All Categories Except One
- Get current taxonomy and display query accordingly
- how to filter posts by category without page load (ajax) in wordpress?
- How to add a block to a category page?
- show only one category and filter by tag
- Filters do not work when there are multiple (one works)
- Manipulate post category after time
- How to get Category Id from Post Id ?
- Categories box not showing on post edit pages
- List only child categories a post is in, of a specific parent category
- how to display post content without post image?
- Add custom field to all posts in specific category
- How to remove_filter that filters iframes in posts? [duplicate]
- is there a better way of combining this?
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- wp_list_categories link to first post of category instead of calling taxonomy template
- If specific user role then sticky post
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- How only display all post related to category
- Add category to all post by using sql query?
- the_posts filter been called multiple time
- Displaying a widget only on long posts (over X characters)
- How to make search for the custom post type?
- Only display posts after current date
- Full Width Main Post
- Filter Home Page Posts in Buddypress [closed]
- Ajax posts filter by date, comments, top views, top likes
- pre_get_posts query between 2 dates (date stored in custom post meta)
- how to remove dash (-) post status from post title on posts listing page wordpress
- Get latest posts from WordPress site without header, menu and sidebar
- How to hide html tags on revision comparison pages?
- More then one menu items are assigned with “current-menu-item” class
- Pulling in post category and children within category
- Post categories to pages
- WP_Query: Mixing category__in and tag__in together
- If in_category not working for multiple single.php pages
- Related posts by category not working right
- Set Default Category to Username
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- Redirect to another page using contact form 7? [closed]
- Display post category in foreach loop
- Single.php – Get Current Parent Category
- add to end of post in the loop with plugin
- How show categories in admin and get that selected to show posts in index
- Adding bootstrap classes to video shortcodes
- if in category but only with post meta
- Display current post position in Elementor Posts widget
- singular posts using archive styling
- Display selected categories onto post page
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Load widget only on blog posts
- Change the background of each post according to the category
- Programmatically add posts from specific category to menu
- Hide parts of the post content after typing it’s name or searching it by category
- SQL Bulk Move old posts by one author to another category
- Widget to show posts in the sidebar basing on its IDs
- load more posts by category
- Get post category as a separate string and url
- How to show category based post in home page?
- How to view all posts (on site, not admin) that are uncategorized?
- How to create a list of links to post with specific category
- Trying to exclude custom posts based on date, while sorting by custom field
- How to show multiple posts thumbnail, title and date in widget
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Show only posts with titles/permalinks that do not contain certain words
- Post meta not working
- get category in list of posts // shortcode for custom related posts
- Featured Story Shortcode not outputting content
- exclude particular category in api
- Make categories appear random
- How to add a ‘News’ section to specific posts in WordPress
- Get Category in save_post Hook
- Get posts from category from custom query
- How to show category image if no featured image is set?
- Override wp_link_pages pagebreak with filter
- How to Get Position of a Post from a category and tag
- How to run select query of post with category and tags?
- Display new posts categories in separated divs
- How to create frontend Post filter using meta query
- Point users to a specific url directory for some posts
- How to test if user is filtering post list in dashboard
- Extracting a TLD from the content and assign to custom field
- Static text above category page
- Show only top 3 posts from 3 categories in order on home page
- Hide categories from showing above a Post
- Order posts by separate menu order for different sub-categories
- Displaying categories items among posts
- Displaying different posts Via wp_list_categories()
- Display ONLY Latest Post From Several Categories
- How can to use the players from the Media Widgets in the body of a post to play audio and video files
- Show all posts in category
- Polylang – display one post into 3 categories with different lang [closed]
- Export Posts Without Categories In An XML File
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Output number of WordPress posts remaining until a post milestone is reached