Using WHERE on a WP_Query
If I understood correctly, you need something like the following: $args = array( ‘post_type’ => ‘book’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘subject’, ‘meta_value’ => YOUR_SUBJECT_PAGE_TITLE, ); $books = new WP_Query($args); Is this what you’re trying to achieve? Also, please have a look at WP_Query.