I found an older post showing what I was missing from my code, so it seems like I didn’t do a good enough search to begin with.
For anyone wondering I was missing 'compare' => 'LIKE'
from the query, so the code would look like this:
$args_post = array('post_type' => 'release', 'orderby' => '_custom', 'order' => 'ASC', 'posts_per_page' => -1, 'meta_query' => array(
array(
'key' => 'classification',
'value' => 'Data',
'compare' => 'LIKE',
),
),
);
Everything’s working like a charm now!
UPDATE
While this solution works, please note @PieterGoosen’s comments to the question:
LIKE
comparisons are quite expensive to run. Also, serialized data is really not meant for searching and ordering operations. The issue here is withLIKE
as well is, if you search fordot
,mydot
,dot
,dotcom
are also returnedWhat the
LIKE
comparator do is, it does not search for exact mathes like a comparator like maybeIN
would do. It searches, for anything that is likely to match the term. If you where to search for a custom field value of saydot
, or lets say as in your exampleData
, the like comparator would search and return anything with those 4 letters in sequence ofdata
, so it would returnData
,data-mining
,database
andcrappy-data
if you have those 4 words in database. So this make theLIKE
very unreliable, which is why you should avoid serialized data