Using meta_query on pre_get_posts to exclude a particular meta_key value

Yes, it behaves weird. No, shoot me, I can’t get a fix on precisely why and how (stacked joins are probably it).

I say flip it. The only posts you don’t want to see are those with true custom key. Query for their IDs separately, feed result into post__not_in, ditch this meta query entirely.

Leave a Comment