For custom post type i have 12 taxonomies (12 months) and each of them with many terms (plant parts - roots, leaves, flowers etc.) On archive page i retrieve a data list with this

foreach($months as $month) :
    $args = array(  'post_type' => 'branje_biljaka', 'posts_per_page' => 100,
            'tax_query' => array( array(
                'taxonomy' => $month,
                'field' => 'slug',
                'terms' => $plant_parts
$branje = new WP_Query( $args );

and it works perfectly. On a single archive page I am stuck. I don't know how to fetch any corresponding data other than the_title() but I need to fetch the same data for every month and all plant parts but only for that specific post.

I dont have any 'normal' data to echo like the_content, only those terms. I think I am complicating this more than I should and I believe Wordpress does this with much less work... but how do I expand the same query so it grabs only current single archive post title? Everything else should be the same...

Inserting something like 'ID' => get_the_ID() into arguments does nothing.

1 Answer 1


Nvm i got it working with


So the code is...

$data = [];
foreach($months as $key => $val) :
    $data[$key][$val] = [];
foreach($parts as $part) {

    if( has_term( $part, $key ) ) {
        array_push($data[$key][$val], $part);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.