Home › Forums › ACF PRO › Find posts by related taxonomy field › Reply To: Find posts by related taxonomy field
found the solution: simply needed to remove the double quotes around the value
// The product's related artist.
$artist = get_field('artist_id');
// The product's most recent related project. If found, get the content of its "Artist" block.
$project = new WP_Query( array(
'post_type' => 'project',
'posts_per_page' => 1,
'orderby'=> 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'artist', // name of custom field
'value' => $artist->term_id,
'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.