I need to create a query that returns all posts with a specific TAG. With the community help I was able to get to the query below but it is returning only ONE result when I have 3 posts marked with that TAG.

    $casestudy_query = new WP_Query( 'tag=homepage' );

    if ( $casestudy_query->have_posts() ) {
    while ( $casestudy_query->have_posts() ) {
    $casestudy_query->the_post(); }} ?>

    <span class="casestudy">
        <a href="<?php the_permalink(); ?>">
        <?php the_post_thumbnail(); ?>
        <?php the_title(); ?></a>
    </span>         *

Appreciate any help!

1 Answer 1


Try an expanded query as your current query is relying on the slug of the tag.

$args = array(
    'posts_per_page'   => -1, //get all posts
    'post_type' => 'post', //assuming your are not using a CPT
    'tax_query' => array(
            'tag' => 'homepage' //select your tag

 $casestudy_query = new WP_Query( $args );

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.