Query posts by tag and custom field
-
Hi Everyone,
I am working on a record label site for a friend and have a catalog section with all the releases in it. Each release is tagged by its respective artist (sometimes more than one artist). Now I am creating the artist section and want to pull in the respective release(s) for each artist into their page. So far I have been using WP_Query for a second loop and it has been working well:<?php $my_query = new WP_Query(‘category_name=catalog&tag=my tag’); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
//my content goes//
<?php endwhile; ?>However I want the tag= to be a custom field key (depending on the artist name). I know how to add custom fields to a post, but dont know if what I want to do is possible. Can anyone help?
Thanks for your time.
- The topic ‘Query posts by tag and custom field’ is closed to new replies.