I have created two custom post types for a music related website: Works and Scores. Each Work has many Scores. I have set CPT-onomies up so that each Work is also a term in the taxonomy Works, and can be selected when I create a new Score.
In the template for single-works, I want to list all the Scores associated with a given Work so I have this code inside the main loop:
<?php $current_work = get_the_title(); ?> <?php echo "<h3>Scores</h3>"; ?> <?php $args = array('post_type' => 'scores', 'tax_query' => array ( array ( 'taxonomy' => 'works', 'field' => 'slug', 'terms' => $current_work))); $the_query = new WP_Query; while ( $the_query->have_posts() ) : $the_query->the_post(); the_content(); endwhile; wp_reset_postdata(); ?>
Can I expect this to work? Currently it is not returning any of the Scores assigned to the Work. It works fine until I add in the tax_query stuff.
What have I missed? Does get_the_title() return anything like the slug content?