Home › Forums › General Issues › Get posts with Relationship Query › Reply To: Get posts with Relationship Query
Do you mean how to get the ID or the title of the artist of the current post from the relationship field instead of using a hard coded name like in your example ‘natasha_yudina’ or you want to show only post from ‘natasha_yudina’?
Either way you are using compare the wrong way I guess. This is purely a wordpress question.
Change this:
array(
'key' => 'artist', // name of custom field
'value' => 'name', // matches exaclty "123", not just 123.This prevents a match for "1234"
'compare' => 'natasha_yudina'
)
To this:
array(
'key' => 'artist', // name of custom field
'value' => 'natasha_yudina' // value of custom field
)
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.