Can’t get exact match with meta_query

On a university website, I use ACF to classify pages for degree programs. I have a shortcode that lets me filter by program type.

`’meta_query’ => array(`

`’relation’ => ‘AND’,`

`array(`

`’key’ => ‘filter_program_type’,`

`’value’ => $atts_args[‘type’],`

`’compare’ => ‘LIKE’`

`),`

`array(`

`’key’ => ‘filter_area_of_study’,`

`’value’ => $atts_args[‘subject’],`

`’compare’ => ‘LIKE’`

`),`

Using LIKE to compare, I get “Undergraduate Programs” when I am looking for the value “Graduate.” I understand this is expected behavior using LIKE, but when I change compare to = I get no results at all. Is there some other way to specify an exact match here?

1 Comment
  1. Check your post_meta table to ensure your expected values are there with the expected keys.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer