Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active November 8, 2019 09:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaredatch/3764391 to your computer and use it in GitHub Desktop.
Save jaredatch/3764391 to your computer and use it in GitHub Desktop.
Redirect taxonomy to use archive template
<?php
/**
* Redirect taxonomy to use custom post type archive template
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param string $template
* @return string
*/
function ja_template_redirect( $template ) {
if ( is_tax( 'code-snippet-tag' ) ) {
$template = get_query_template( 'archive-code-snippet' );
}
return $template;
}
add_filter( 'template_include', 'ja_template_redirect' );
@netzgestaltung
Copy link

8 years ago and works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment