Support

Account

Home Forums General Issues Numberposts & Meta Query Not Working Reply To: Numberposts & Meta Query Not Working

  • Your question has made me realise that the issue is probably not with the ACF part but the Custom Post Types taxonomy I was querying.

    get_field is correctly pulling the field ID. However, my $args was not querying for posts filtered by taxonomy. I’ve changed the code to:

      <?php $relatedCat = get_field('service_related_industry');
         $args = array (
    		'posts_per_page' => 3,
                    'post_type' => 'case_study',
    		'tag_id' => '"'.$relatedCat.'"',
    		'orderby' => 'DESC',
    

    It’s still not working properly, but at least now it isn’t pulling all the posts (it’s pulling exactly the 3 latest, while ignoring the ‘tag_id’ filter).