Thanks for responding.
actually i code it before opening this support thread. my code is almost same as the above thread you linked but my problem is it’s not working with multiple values. means when the page / post contain multiple values ( actually it’s an array of values ) the relation code not working, and the above code is working only with two values but what if i have more than two values ?
i have an ACF checkbox with many values ( like value1, value2, value3, … , value10 ). the above code may works fine for one or two value but how i should loop it to work with the array.
also this is my code:
$checkbox_field = get_field( 'checkbox_field', $post->ID ); $checkbox_field_opts = implode( ", ", $checkbox_field); $args = array( 'post_type' => 'page', 'post__not_in' => array( $post->ID ), 'posts_per_page' => $related_no, 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'checkbox_field', 'value' => $checkbox_field_opts, 'compare' => 'LIKE' ) ) );
i tried to implode it, but that’s not working too.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.