Last active
December 26, 2015 07:59
-
-
Save toby-griffiths/7119231 to your computer and use it in GitHub Desktop.
WordPress - How to redirect a custom post type's single page to a taxonomy page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wp9899234_parse_query() { | |
if ( is_admin() || is_single() || '<post_slug>' !== get_post_type() ) { | |
return; | |
} | |
// Work out taxonomy page | |
// $tax_permalink = ...? | |
wp_redirect( $tax_permalink ); exit; | |
} | |
add_action( 'parse_query', 'wp9899234_parse_query' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment