Home › Forums › General Issues › Reverse Relationship: Page & Custom Post Type › Reply To: Reverse Relationship: Page & Custom Post Type
OK, I managed to solve it by myself… the main problem was, that I used the name of the custom post type instead of the name of the ACF-relationship-field.
$methods = get_posts(array(
'post_type' => 'page',
'meta_query' => array(
array(
'key' => 'persons', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
'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.