In my WordPress theme I created the custom post type articles. I also created two taxonomies called article & news. How can I display each taxonomy in its own single template? For now it only displays using the single-articles.php template.

2 Answers 2


Use the single_template filter in your functions file with the correct conditional tag

add_filter( 'single_template', 'single_tax_term_template' );
function single_tax_term_template( $single_template ) {

    global $post;

   if ( has_term( '', 'article' )  ) {
          $single_template = dirname( __FILE__ ) . '/article.php';

    if ( has_term( '', 'news' )  ) {
          $single_template = dirname( __FILE__ ) . '/news.php';

    return $single_template;

This code targets all terms in news and article taxonomies.


You will need to read the taxonomy template article on WordPress.org for that information.

  • This article doesn't contain an answer to the question related to the single post template. Sep 12, 2017 at 17:30
  • It is the first bullet point on the page. Jul 8, 2021 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.