You can't use
numeric (at least I am pretty sure you can't).
numeric will try to convert the whole
value to a number. That will fail, as it isn't a number. That is the first mistake.
Secondly, to get a literal
%, you need to double it to
%%. Note: I can't remember about
meta_query strictly speaking. I am extrapolating from what it takes to get a
% to pass through
$wpdb->prepare I think it is the same though. Edit: This appears to only be true with
$wpdb->prepare. The code has been edited.
I have not tested this, as I'd need to setup some things in my database and don't have time right now, but I think it will work.
$practiceArgs = array(
'post_type' => 'attorney',
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_query' => array(
'key' => 'practice_area',
'value' => $post->ID,
'compare' => 'LIKE'
I hope that is the push you need. If it doesn't work I will revisit.
Edit: I inserted your (broken) serialized array into my database and ran the code above. If I get everything set up correctly-- the meta_fields, the post types, etc.-- the code above works. If it isn't working for you you've got something else going on-- maybe you think there should be a match where there isn't.
I am assuming that you are going to have an array like that for every one of your 'attorney' posts. If you do, that should work. I might lean toward multiple
practice_area rows though, instead of using a serialized array.
= is a more efficient query than
LIKE, especially when you have wildcards, and your results should be more accurate. Indexing (MySQL database) should work better as well.