0

I'm using a plugin (IssueM) which gives the "articles" post-type a custom taxonomy called "Issues".

I'm trying to return all "articles" which have the taxonomy issue-one set (which is the slug name). But I cannot get it to return anything:

$the_query = new WP_Query(
array(
'post_type' => 'article',
'posts_per_page' => -1,
'taxonomy' => 'issue',
'term' => 'issue-one'
)
);

I'm not sure whether the taxonomy field needs to be issue or issues so I've tried both but neither work. I have tried the slug name for the term e.g issue-one and also the written name e.g Issue One.

I have been instructed elsewhere that I need to use a taxonomy query instead, here is what I have so far:

'tax_query' => array(
    array(
       'taxonomy' => 'Issues',
       'field'    => 'slug',
       'terms'    => 'issue-one'
    ),
 ),

Attempted the following, no luck:

$args = array(
    'post_type' => 'article',
    'tax_query' => array(
         array(
           'taxonomy' => 'Issues',
           'field'    => 'issuem_issue',
           'terms'    => 'issue-one'
     ),
 ),
 'posts_per_page' => -1
 );
2

I looked at the source code for IssueM. I think the slug you are after is issuem_issue

However, there are two more taxonomies it registers: issuem_issue_categories and issuem_issue_tags

Edit

Try changing your args to:

$args = array(
    'post_type' => 'article',
    'tax_query' => array(
         array(
           'taxonomy' => 'issuem_issue',
           'field'    => 'slug',
           'terms'    => 'issue-one'
     ),
 ),
 'posts_per_page' => -1
 );

This should all articles with the issuem_issue taxonomy slugged 'issue-one' attached to it.

|improve this answer|||||
  • I believe you are correct. the _categories is something different (I can give an article a category like 'Car Reviews' and the tags, again, is something that can be applied to the post. I will try with that taxonomy. – Francesca Mar 16 '15 at 15:38

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.