I am trying to include a meta_query to only show the 'post_type' => 'want-to-sell-post'
that have the key 'key' => '_wpcf_belongs_artist_id',
.
Right now, all want-to-sell-post
s are being displayed, and the meta_query is being ignored. What's the error in the way I'm writing this?
Thanks so much!
<?php
$artist_id = get_the_ID();
$want_to_sell = new WP_Query( array(
'post_type' => 'want-to-sell-post',
'posts_per_page' => 5,
'meta_query' => array(
'key' => '_wpcf_belongs_artist_id',
'value' => $artist_id,
'compare' => '=',
),
));
?>
<div class="container">
<div class="row row-cols-1 row-cols-lg-1 justify-content-center">
<?php if ( $want_to_sell->have_posts() ) : ?>
<?php while ( $want_to_sell->have_posts() ) : $want_to_sell->the_post(); ?>
<?php include get_template_directory() . '/includes/containers/marketplace-sell-artist-page.php' ;?>
<?php endwhile;?>
<?php else: ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
</div>