Created
September 17, 2010 00:40
-
-
Save anthonycole/583450 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| add_action('template_redirect', 'wtv_redirect'); | |
| function wtv_redirect($url) { | |
| $url = $_SERVER["REQUEST_URI"]; | |
| $wines = get_terms( array('wtv_wines') ); | |
| foreach( $wines as $wine ) { | |
| if( stripos( $url, $wine ) && stripos( $url, 'category') ) { | |
| wp_redirect( get_term_link($wine, 'wtv_wines' ), 301); | |
| exit; | |
| } | |
| } | |
| $locations = get_terms( array('wtv_locations' ) ); | |
| foreach( $locations as $location ) { | |
| if( stripos( $url, $location ) && stripos( $url, 'category') ) { | |
| wp_redirect( get_term_link( $location, 'wtv_locations' ), 301); | |
| exit; | |
| } | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment