admin管理员组

文章数量:1130349

i have an array of meta values of an unknown length and i'm trying to query for posts that contain them.

The type of meta value is the checkbox type. So in ACF this is a list of 10 different checkboxes you can check. I take the checks made in HTML and am trying to query for posts with them when someone presses search.

here's what I have

$query = new WP_Query( array(
            'posts_per_page' => 12,
            'post_type' => 'post',
            'post_status' => 'publish',
            'meta_query' => array(
            array(
                'key' => 'category',
                'value' => $checkboxes,
                'compare' => 'In'
            )
        )
        ) );

the name of ACF checkboxes field is category, i'm trying to check if anything from category is in my checkboxes array. but nothing shows up>

i have an array of meta values of an unknown length and i'm trying to query for posts that contain them.

The type of meta value is the checkbox type. So in ACF this is a list of 10 different checkboxes you can check. I take the checks made in HTML and am trying to query for posts with them when someone presses search.

here's what I have

$query = new WP_Query( array(
            'posts_per_page' => 12,
            'post_type' => 'post',
            'post_status' => 'publish',
            'meta_query' => array(
            array(
                'key' => 'category',
                'value' => $checkboxes,
                'compare' => 'In'
            )
        )
        ) );

the name of ACF checkboxes field is category, i'm trying to check if anything from category is in my checkboxes array. but nothing shows up>

本文标签: advanced custom fieldsHow to query wordpress with array of metavalues