Home › Forums › General Issues › Call posts based on relationship value › Reply To: Call posts based on relationship value
Ok… so I’ve tried it a few different way and am still missing it.
I checked my database and here is what my Hello World! post has in it for directory_news:
a:2:{i:0;s:2:"65";i:1;s:2:"23";}
So that’s showing me that profiles with the ID of 65 and 23 are linked to that post…
So then I thought I followed the example that you provided with this
$mine = get_posts(array(
'post_type' => 'post', // "post" because I'm calling regular blog posts?
'meta_query' => array(
array(
'key' => 'directory_news', // slug of custom field
'value' => '65', // hardcoded it just to test
'compare' => 'LIKE'
)
)
));
You’ll see that instead of using the ID I just hardcoded 65 in there just to see if I could only pull that one…
However this still spits out ALL posts.. and not the ones that have David in the relationship 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.