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(
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.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.