Home Forums General Issues Meta query for post object? Reply To: Meta query for post object?

  • I have a problem with trying to implement something similar…
    Here is my setup…

    Custom post type : ‘images’
    Custom post type : ‘authors’

    I have a multiple select post_object field on the images edit screen where you can select multiple authors. I have set this to output a post object in the acf edit field group page because I use various fields from the authors on the image display.

    Now I have a filtering option in the images archive and want to be able to query images of a particular author.

    $images_query = new WP_Query([
        'posts_per_page' => -1,
        'post_type' => 'images',
        'meta_query' => array(
                'key' => 'author',
                'value' => get_query_var('author'),
                'compare' => 'LIKE'

    I have got everything working without the meta_query so it’s not a loop problem, but nothing is showing up from my output loop when I add the meta_query.

    Does anyone know if the problem is due to my acf output being a post object rather than a post id? Please advise.