Home › Forums › General Issues › Query in relationship field › Reply To: Query in relationship field
This tutorial goes over everything you need to query relationship fields http://www.advancedcustomfields.com/resources/querying-relationship-fields/
Basically, for what you want you need to use “LIKE” and the double quotes around the value are important.
$args = array(
'numberposts' => -1,
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'relation_user',
'value' => '"1"',
'compare' => 'LIKE',
)
)
);
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.