I've been back and forth with this and not able to get my Advanced Custom Field query working.
According to the documentation in the link above, this is what my array should look like:
$args = array(
'numberposts' => -1,
'post_type' => 'event',
'meta_key' => 'location',
'meta_value' => 'Melbourne'
);
Below is my array. The problem is clearly in the meta_key and meta_value I am trying to query. Without the meta_key and meta_value, all the Products are being returned as expected. I have been into the database to make sure I have the right values so this looks correct to me. Is there something that stand out to anyone I might be missing? Thanks
<section class="entry-content clearfix search-results sectiondrop" itemprop="articleBody">
<h3>Search Results</h3>
<?php
$args = array(
'post_type' => 'Product',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'meta_key' => 'product_type',
'meta_value' => 'Paper'
);
$loop = new WP_Query( $args ); ?>
<ul>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li>
<strong><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a> - <?php the_field('product_type'); ?></strong><br>
<?php the_field('product_description'); ?><br><br>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>
<?php } ?>
</section>