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,
'order' => 'DESC',
'meta_query' => array(
'key' => 'artist', // name of custom field
'value' => $artist->term_id,
'compare' => 'LIKE'
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users