@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?
- Category display using conditions
- Custom Taxonomies not appearing in Admin
- Conditional Statement custom post type category
- Custom Post Type With Categories
- Custom Post Type Taxonomy Filters
- Categories sorting
- Allow user to set custom order to a list of custom taxonomies?
- get_category_parents for custom post type taxonomy
- wp_list_categories() – current-cat class also inside posts?
- Custom Taxonomy back-end customizations
- Show a Category X’s custom post type on Category X archive page?
- Taxonomy custom post type URL
- 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
- Get related posts of child term of custom post type
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Can’t remove front from permalinks for custom taxonomy category page
- list taxonomies from a custom post type
- Display a grid of taxonomy terms at root taxonomy page
- limit value taxonomy based on previous taxonomy value wordpress
- How do I display the taxonomy for a custom post type in an array
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- How do I display the grand child items of a taxonomy term?
- How to edit this code to get the categories in achieve page?
- Taxonomies relations
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Full Custom Post Type List Organised by two Taxonomies
- WordPress Doesn’t Generate Taxonomy Archive
- Suggested Post and Taxonomy structure
- Hierarchy and access control for Custom Post Types (CPT)
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Custom post with more than one custom taxonomy
- How to get custom posts sub category link
- Get the taxonomy of a post hierarchically
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- How to get list of taxonomy slugs ordered parents>childs?
- browse by category and tags?
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- How do I share categories across multiple post types?
- Multiple tag cloud filtering
- List of Posts and Categories
- Get url.com/post_type/taxonomy/term work!
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy in URL
- Different Category system needed for the Custom Post Type
- WP the_posts() on single-cars.php get category link
- How to Set Taxonomy Object Description?
- Categories and tags for custom post types
- in_category for custom post types
- Custom select query for taxonomies that have posts categorized in another taxonomy
- Get parent category id from child category page for custom taxonomy
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Rename a slug label
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- How to add current custom taxonomy slug to body class
- Custom taxonomy (categories) on custom post type return no results
- Variable not working in WP_Query
- Hide meta box for everything BUT a certain custom post type
- List Posts By Custom Taxonomy
- How to Display Posts From Category Within a Custom Taxonomy?
- Disable custom taxonomy on admin bar
- Why does my taxonomy have a category style div id?
- How can I create an automatic drop down menu with my tags?
- How to define a term for custom taxonomy
- Invalid Taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- Need help deciding on a taxonomy
- Alphabetically sort a taxonomy.php template by post title
- Listing all slugs?
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Get taxonomy singular name instead of taxonomy slug inside $taxonomy query
- Get Posts by Category, Tag , and CPT Taxonomy
- Show Taxonomies with admin area for custom post type?