Home › Forums › Front-end Issues › Display parent\'s relationship on child post › Reply To: Display parent\'s relationship on child post
I have a feeling that I am not completely understanding how the relationships between your post types and posts work.
But I think I’ve worked out what you want to do
function my_post_object_query($args, $field, $post_id) {
$parent = wp_get_post_parent_id($post_id);
$meta_query = array(
array(
'key' => 'pro_to_con',
'value' => $parent,
'compare' => 'LIKE'
)
);
$args['meta_query'] = $meta_query;
return $args;
}
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.