LIKE %…% Meta Query

Question

I have a serialized array as a meta value and I’m trying to run WP Query where it finds a specific value in the serialized array.

Here’s an example of the serialized array field:

a:6:{i:0;s:3:"173";i:1;s:3:"172";i:2;s:3:"171";i:3...

Here’s my query, but it doesn’t work:
The ID’s are numberic I’m doing a search for as well.

$practiceArgs = array(
    'post_type' => 'attorney',
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'meta_query' => array(
                        array(
                              'key' => 'practice_area',
                              'value' => $post->ID,
                              'compare' => 'LIKE',
                              'type' => 'NUMERIC'
                              )
                        )
);

I’ve tried using 'value' => '%'.$post-ID.'%' in my queries, but it doesn’t seem to work as well.

Anyone ever had any experience working on this?

0
Troy 8 years 2013-02-08T09:56:02-05:00 0 Answers 79 views 0

Leave an answer

Browse
Browse