Query Loop "post_status" meta query not working

I have made a query loop, i only want pending posts to show in this query loop, so I set the META QUERY Meta key to post_status and the Meta value to pending.
However this doesn’t work:
image
How can I make this work?

Hey @div,

post_status is not a meta key (see WP_Query documentation). You can use the bricks/posts/query vars hook to add the post_status parameter instead:

add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
    if ( $element_id === 'your_element_id' ) {
        $query_vars['post_status'] = 'pending';
    }

    return $query_vars;
}, 10, 3 );

Best,

André

3 Likes

This works, thanks!!

Hi André

out of curiosity and mainly because I can’t get this to work on my ACF Relationship Query, can you confirm that the query_vars filter is indeed working also for an ACF Relationship Query in Bricks V1.8.1?

Thanks and best regards

Patric

Hey @Patric,

no. This filter is not applied for custom queries (like ACF or Meta Box relationships).

Best,

André

1 Like