Ok, I used Custom Post Types Ui to create several custom post types. When setting up the CPT's I checked off that categories were enabled, and then I added a few categories to one of the CPT's. Now I'd like to call one of the categories (upcoming-meetings on a page, but it doesn't seem to be working. Here's my code:

    <?php $cpt = get_post_meta($post->ID, "my_meta_box_select", true); ?>

    <?php $temp = $wp_query;
     $wp_query= null;
     $wp_query = new WP_Query(); ?>

     <?php $wp_query->query("post_type= '.$cpt.'&paged=".$paged.'&showposts=5&cat=upcoming-meetings'); ?>

Any help would be appreciated. I looked around some, but didn't quite understand the difference between Categories and Taxonomies. If anyone wants to shed some light on that for me, that would be great as well.

Thanks, Matt

1 Answer 1


Most likely, your Custom Post Types are using custom taxonomies that happen to be named "Category". Try something like this:

$args = array(
    'post_type' => $cpt,
    'tax_query' => array(
            'taxonomy' => '[whatever your taxonomy is named],
            'field' => 'slug',
            'terms' => 'upcoming-meetings',
$query = new WP_Query( $args );

You may be able to find out the taxonomy name from a management screen in the backend. I'm not familiar with the Custom Post Types UI plugin, so unfortunately I can't really help you there.


"Taxonomy" is a catch-all term that encompasses WordPress's native Categories, Tags, and any custom taxonomies that you (or a plugin) may create. So "Category" is a type of taxonomy, as is "Tags".


WP_Query on the Codex

  • Thanks for the help, got me on the right track! Here's what my end result was: <?php $cpt = get_post_meta($post->ID, "my_meta_box_select", true); ?> <?php $args = array( 'post_type' => $cpt, 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => 'upcoming-meetings', ) ) ); $wp_query->query( $args ); ?>
    – mtuttle
    Commented Jul 17, 2013 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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