WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to display posts from a 'Uncategorized' category under a custom taxonomy called 'Reviews' but without much luck.

I'm using get_template_part('loop','review') to call loop-review.php which contains my taxonomy loop but for some reason, nothing will show up. What gives?

Here are the contents of loop-review.php...

<div class="row no-margin detail">
    <p class="title"><span>reviews</span></p>

    $args = array(
        'post_type' => 'post',
        'tax_query' => array(
                'taxonomy'  => 'review',
                'field'     => 'slug',
                'terms'     => 'uncategorized'
    ); $review_query = new WP_Query($args); ?>
    <?php if ($review_query->have_posts()): ?>
            <?php while ($review_query->have_posts()): $review_query->the_post(); ?>
                    <p class="quote">
                            <?php the_content(); ?>
                            <span><?php the_title(); ?></span>
            <?php endwhile; ?>
            <!-- end of the loop -->
                    <?php wp_reset_postdata(); ?>
    <?php else:  ?>
                    <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>

I call get_template_part('loop','review') inside my my category.php...



if (is_category('portfolio')): 



Lastly, here is the code from my functions.php...

add_action('init', 'build_taxonomies', 0);
function build_taxonomies(){
        register_taxonomy('review', 'post', array(
            'hierarchical'    => 'true',
            'label'           => 'Reviews',
            'query_var'       => 'true',
            'rewrite'         => 'true'
share|improve this question

There are no methods the_content() or the_title() of your query object.



should just be


If you had debugging enabled you would see an error informing you of this.

share|improve this answer
Thanks but still no posts. I've updated my code to reflect your feedback. Also, I've enabled debugging and am not receiving any errors? – Wilhelm Apr 15 '14 at 13:23
are you sure there are posts that match the query? var_dump($review_query); and inspect the query parameters, make sure there isn't a filter of some sort altering the query. – Milo Apr 15 '14 at 17:30
I've tried that already. I have two posts in 'Uncategorized' category in 'Review' but var_dump returns nothing. – Wilhelm Apr 15 '14 at 22:22
var_dump after the query is run is empty? – Milo Apr 16 '14 at 0:06
I tried putting it after the query and in the loop. Nothing was dumped. – Wilhelm Apr 16 '14 at 22:58

At first glance, I see that your query is calling for 'post_type' => 'page' while the taxonomy is registered on the post object type. Changing the post type to post ('post_type' => 'post') should fix the problem.

share|improve this answer
Thanks but this didn't work. I've updated my code. – Wilhelm Apr 15 '14 at 3:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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