Custom query filtered by custom field which is an array

I have a custom field in my posts called “position” , Actually i created it with ACF checkboxes and it returns an array.Now i wanna query posts filtered by this custom field in this way that if value “x” is in the custom field then show the post. I tried this code but it doesn’t work 🙁

$posts_sabet_1 = new WP_Query(
    array(
        'post_type'      => 'sabet',
        'posts_per_page' => -1,
        'meta_query' => array(
            array(
                'key'      => 'position', // array
                'value'    => 'top', // is "top" in "position" field?
                'compare'  => 'LIKE' // I also tried "IN" , "=" , "RLIKE" . none of them worked
            )
        )
    )
);

Related posts

Leave a Reply

1 comment

  1. Did you try something like this ?

    $posts_sabet_1 = new WP_Query(
        array(
            'post_type'      => 'sabet',
            'posts_per_page' => -1,
            'meta_key' => 'position'
            'meta_value' => 'top'
            )
    );