I am not able to get the listings to show up. I have verified the slug for the post type and the taxonomy. This code I know works because I have used it for other post types and taxonomy's. Any insight as to why this would not be working here would be appreciated. Thanks.


$tag = 'commercial_for_lease';

// Set up custom query with meta_query
$args = array (
    'post_type'              => 'wp-listings', // your property post type slug
    'posts_per_page'         => 50,
    'orderby'                => 'rand', // order by
    'order'                  => 'ASC', // Show earlier events first
    'tax_query'              => array(
                                    'taxonomy'  => 'property-types',
                                    'field' => 'slug',
                                    'terms'     => array($tag)

    $query = new WP_Query( $args );
        if ( $query->have_posts() ) :
        while ( $query->have_posts() ) : $query->the_post(); ?>

        <div class="col-md-4" id="<?php echo get_the_id(); ?>">
            <div class="row">
                <a href="<?php the_permalink(); ?>">
                    <div class="item-container">                                                    
                    <div class="item-container-img">
                    <?php the_post_thumbnail(); ?>
                    <div class="item-container-text">
                        <h4><?php the_title(); ?><h4>
                        <h5><?php echo get_post_meta( get_the_ID(),'listing-price', true); ?></h5>                                                                   

<?php endwhile; wp_reset_query(); ?>
<?php wp_reset_postdata(); 

1 Answer 1


I suggest starting your query by first only passing the post_type and posts_per_page arguments. This will let you know if you're getting the right entries and if so then begin to use your filters (orderby, order, etc).

  • Thanks BShelling! After digging into the plugin more I found I was using the incorrect post_type slug. Thanks Dec 11, 2018 at 15:46

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.