Home › Forums › ACF PRO › Filter customs posts with relationships › Reply To: Filter customs posts with relationships
Not sure if you’re using a relationship field or a user field by your description, but either of these are similar. They hold an array of IDs to either posts or users. There is no way to filter these easily if you want to select more than one value.
You should look a the Multiple custom field values (array based values) section of https://www.advancedcustomfields.com/resources/query-posts-custom-fields/.
As these are ID values what you see in the example here
array(
'key' => 'location',
'value' => 'Melbourne',
'compare' => 'LIKE'
),
Should be replaced by something like
array(
'key' => 'location',
'value' => '"'.$ID.'"',
'compare' => 'LIKE'
),
as in the single-location.php section of https://www.advancedcustomfields.com/resources/querying-relationship-fields/
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.