Support

Account

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'
    				)
    			)
    		));