Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7514005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:21:52+00:00 2026-05-30T00:21:52+00:00

Ive been struggling with a wordpress issue for a few weeks now and i

  • 0

Ive been struggling with a wordpress issue for a few weeks now and i just cant figure it out.

I have created a custom post type called ‘cpt_used’, in that custom post type i have created a custom taxonomy called ‘tax_used’, which is a categories list

What i need to do is show all posts that belong to each custom taxonomy and i just cant figure it.

the code i have at the moment is as follows, there are multiple posts in each of the categories, but its just not displaying anything

$args = array(
    'orderby' => 'name',
    'hide_empty' => 0,
    'taxonomy' => 'tax_used'
);
$categories = get_categories($args);

foreach( $categories as $category ) {

    $newargs = array(
        'category_name' => $category->slug,
        'taxonomy' => 'tax_used',
        'term' => 'cpt_used'
    );

    query_posts( $newargs );
    if (have_posts()) :
        while (have_posts()) : the_post();
            the_title();
        endwhile;
    endif;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:21:53+00:00Added an answer on May 30, 2026 at 12:21 am

    $newargs are totally messed. try this:

    $newargs = array(
     'post_type' => 'cpt_used',
     'tax_query' => array(
      array(
       'taxonomy' => 'tax_used',
       'field' => 'slug',
       'terms' => $category->slug
      )
     )
    );
    

    and remember print_r() sometimes returned values to check if it is exactly what you want before you start to iterate it 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been struggling with a linker error that i cant seem to figure out,
I've been struggling with this issue for a little while now. Found several posts
I've been struggling with Spring Security LDAP for a while now, and just when
I've been struggling with this issue for a while now, and none of the
I've been struggling for several hours trying to figure out how to get this
I've been struggling with Logging in Wordpress for a while now with CURL (PHP).
Ive been struggling with this for a day or two. Not just the coding
I've been struggling with this check constraint for a few hours and was hoping
I've been struggling looking for an understandable way to do this. I have four
I've been struggling with this one for a couple of days now. My current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.