I have created a custom post type 'interview' and also created custom taxonomy 'interview_category' for the interview custom post type, that custom taxonomy have terms like students, teachers, entrepreneur and some others.

I created a 'archive-interview' template for interview custom post type, what i need is the custom taxonomy terms of interview custom post type use the same template 'archive-template'.

i previously did this task but that time interview was a parent category of students, teachers etc. the code i used that time is

add_action('template_redirect', 'UseParentTemplate');

  function UseParentTemplate() {
   if (is_category()) {
    $catid = get_query_var('cat'); //current category id
    $category = get_category($catid);
    $parent = $category->category_parent; //immediate parent
    if ($parent){
        $parentCategory = get_category($parent);
        $parentName = $parentCategory->name;
        $parentid = get_cat_id( $parentName );
            if ( file_exists(TEMPLATEPATH . '/category-' . $parentCategory->slug .    '.php') ) {
                include (TEMPLATEPATH . '/category-' . $parentCategory->slug . '.php');
            return true;

I work on custom post type first time please help me out from this, any help will be appreciated buddy.

1 Answer 1


You should call your file taxonomy-interview_category.php to be automatically associated with your custom taxonomy.

If you want it to look like interview archive, you can just include archive-interview.php in your newly created taxonomy-interview_category.php.

I suggest you have a look at this image that explains WordPress template hierarchy and logic:


  • thanks for reply bro i added this code in my function.php it work fine for me function UsecustomTemplate() { if (is_tax( 'dastak_interview_category' )) { include(TEMPLATEPATH . '/archive-dastak_interview.php'); } } Dec 26, 2014 at 6:39
  • The this is that such custom solutions like yours in functions.php will be a big pain in someone's butt once they have to change this behaviour, as they will be expecting exactly that template file to exist (or taxonomy-dastak_interview_category.php, if this is the real name of the taxonomy). Just have all this in mind, if you are going to sell or release freely this theme!
    – vlood
    Dec 26, 2014 at 7:18
  • yes you are right bro that will be pain if i am going to sell.thanks for your suggestion i will keep that in mind too Dec 26, 2014 at 8:32
  • Hey, it'd be great if you could mark the answer as a solution to your case :)
    – vlood
    Dec 26, 2014 at 9:51

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.