1
votes

I have searched high and low for an answer to this query (pun intended).

I am trying to query all posts where the repeater field has sub fields with a value (i.e. not empty). This is currently pulling through all posts in the post_type 'sites' with the correct order, but the meta_query is having no effect.

<?php
$args = array(
    'post_type' => 'sites',
    'orderby' => 'meta_value_num',
    'posts_per_page' => 5,
    'meta_query' => array(
        array(
            'key' => 'bonuses',
            'compare' => '!='
        )
    )
);
query_posts($args);

while (have_posts()):
    the_post(); ?>
1
Why are you using query_posts instead of new WP_Query? When you're using meta_query I believe you have to use the 'value' to compare with.CaldwellYSR

1 Answers

0
votes

Try to replace 'compare' => '!=' with 'value' => 'EXISTS' and see if that helps.