Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type registered as publication and a custom taxonomy registered as publication_category.

The post type's slug is publication and the taxonomy slug is publication/category.

The reason I have it set up like that is to get these urls - Archive - Single - Category Archive

The problem is that when I go to this url the post_type is not set so it uses the default archive template.

Is there a way without passing in ?post_type=publication that I can set the post_type to publication so it uses the publication archive template?

share|improve this question

1 Answer 1

It turned out that the post_type was being set but for some reason it would not load the appropriate archive template. I'm suspect it has something to do with the way my post type and custom taxonomy are set up.

Here is a solution I came up with. I'm open to suggestions.

function custom_template_redirect() {
    if (is_archive() && get_post_type() != '') {
        $file = TEMPLATEPATH . '/archive-' . get_post_type() . '.php';
        if ( file_exists( $file ) ) {
            include ($file);
add_action('template_redirect', 'custom_template_redirect');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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