Home › Forums › ACF PRO › Filter relationship field of post type › Reply To: Filter relationship field of post type
In the above function, is it possible to get the post_type somehow?
I am thinking to use this same field in more post_types, so it would be nice if I could do something like:
if ('places' = $post_type) {
$meta_query = array(
array(
'key' => 'place',
'value' => $post_id,
'compare' => 'LIKE'
)
);
$args['meta_query'] = $meta_query;
}
I tried global $typenow
but it didn’t do it.
My other option is to create additional field groups…
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.