@ricardio-de-penning
I think you are going on wrong direction.
You just want to get only those posts which is related to current category right?
If yes then you need to filter post using tax_query like below.
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'term_id',
'terms' => array($cat_ids),
'operator ' => 'IN',
),
),
);
$query = new WP_Query( $args );
Related Posts:
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to list all categories and tags in a page?
- Custom post type taxonomy template
- Show Post Count of a Category
- How to create new category for custom post type?
- Display all posts in main category and 1 subcategory
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Limit amount of posts made within a custom taxonomy
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- get_category_link() for custom post type does not include custom slug rewrite?
- Targeting categories in custom fields
- Create custom post type categories
- Set a Default CPT taxonomy by taxonomy id
- How to manage a dynamic multi-level page hierearchy system?
- Categories manage
- Is it possible for post and custom post type to share a category base slug?
- How to change permalink structure for custom post type and it’s taxonomies?
- Get the first post term
- Exclude a category from WP_Query
- Creating “static” taxonomies to choose from, inside custom post type?
- How to build a complex page structure
- Custom taxonomy not showing up when adding a new custom post type
- How do I list custom taxonomy terms without the links?
- How to filter custom post types by custom category taxonomy
- Is there a way to use regular categories with custom post types?
- Create an archive page for custom taxonomies
- remove support for ‘Categories’ for a custom post type
- How can you make permalink work for custom post type and taxonomy?
- Filter get_categories() for taxonomy term in WordPress
- How do I list terms of a custom taxonomy at i.e. domain.com/brands/
- Taxonomy-{taxnonomy}.php is not working
- Get list of terms of current taxonomy archive for another taxonomy
- Associate Taxonomies Across Post Types
- Display Custom Category (taxonomy) Name in Custom Post Type
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Relationship between two taxonomies and a custom post type [closed]
- Menu Multiple Taxonomies
- Combining custom post type and post category
- How to make a custom taxonomy selectable in post publish area?
- Custom page template for category taxonomy
- How to get the post type from a category id?
- Insert HTML inside link in a walker
- Set menu active state for custom posttype and category, given custom taxonomy term
- How do I get array of types associated with a taxonomy?
- Show category ID on custom post type
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- get_category_parents for custom post type taxonomy
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- How to Filter custom post type by taxonomy?
- Is it possible to have dedicated page for parent/child taxonomy?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Hide parent categories when clicked, and show it’s childs
- limit value taxonomy based on previous taxonomy value wordpress
- How do I display the grand child items of a taxonomy term?
- Is it better to use WordPress Custom Post Types or Taxonomies?
- How to get custom posts sub category link
- WP the_posts() on single-cars.php get category link
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Why does my taxonomy have a category style div id?
- Invalid Taxonomy
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- category list with cutom post count
- Include custom post type custom taxonomies in Categories widget
- Changing CPT slug and taxonomy already registered in parent theme
- Custom post type categories gives 404 error
- Custom Taxonomy Terms in Menu lead to which page?
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Custom post type specific category box
- Custom Taxonomy Taxonomies of Same Name point to first created URL
- Query Custom Post Type by Taxonomy
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- How to order taxonomy terms by most recent post?
- How to set “section categories”?
- Custom taxonomy returns 404 even with saving permalinks
- Change custom post taxonomy values from front-end
- List all posts associated under custom taxonomy
- how to create custom taxonomy drop downs for parents and child
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- Pages of my taxonomy terms are showing all posts
- Custom post type category link + add to menu
- Single taxonomy for different custom post types
- How to create groups like that in buddypress?
- Filter Term By Parent Term – Custom Post Type
- Best approach to allow front-end display of posts’ reviewers?
- Custom Post Type and Taxonomies, creating the corresponding template file and loop the data
- Post Editor: display categories from current post type taxonomy only?
- List all posts from custom post type by taxonomy
- Displaying taxonomy icon outside archive page
- Archive templates based on taxonomies
- Trying to create hierarchy between 3-4 custom post types
- Customize category URL
- show only one category posts in admin
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Show custom category archive as front page and remove taxonomy slug from urls