title: WordPress Meta Query Arrays
body: <p>I'm building a way form my users to "like" a post.</p>
  
  <p>I'll have an array of users that have liked posts:</p>
  
  <pre><code>$user_ids = array(60, 61, 62, 63);
  </code></pre>
  
  <p>And then a post will have a post_meta that saves the user ID when the "like" button is clicked on a post, like so:</p>
  
  <pre><code>// Build array of user IDs that have liked this post
  $likes = array(61, 62);
  
  // Save array
  update_post_meta($post-&gt;ID, likes, $likes);
  </code></pre>
  
  <p>So how can I return all posts liked by the users. This is how I'm doing it currently, which doesn't work.</p>
  
  <pre><code>$args = array(
      'post_type'         =&gt; 'post',
      'post_status'       =&gt; 'publish',
      'posts_per_page'    =&gt; -1,
      'orderby'           =&gt; 'rand',
      'meta_query'        =&gt; array(
          'relation'  =&gt; 'AND',
          array(
              'key'       =&gt; 'likes',
              'value'     =&gt; $user_ids,
              'compare'   =&gt; 'IN'
          )
      )
  );
  $posts = get_posts($args);
  </code></pre>
  
  <p>This should return all posts that have '60, 61, 62, 63' saved in the posts 'likes' meta. But it returns 0 results.</p>
  
  <p>Now, I think this is because WordPress serializes arrays when they are saved in a post_meta.</p>
  
  <p>So, how do I a do a query like this? Is it even possible? Maybe I have to use the $wpdb class.</p>
  
  <p>Thanks!</p>