Last active
July 25, 2018 12:14
-
-
Save wolfthemes/67fa32f34548c47ed62c472117299e97 to your computer and use it in GitHub Desktop.
Rewrite band taxonomy slug
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
| /** | |
| * Rewrite band taxonomy slug | |
| */ | |
| function theme_change_band_taxonomies_slug( $args, $taxonomy ) { | |
| if ( 'band' === $taxonomy ) { | |
| $args['rewrite']['slug'] = 'artist-releases'; | |
| } | |
| return $args; | |
| } | |
| add_filter( 'register_taxonomy_args', 'theme_change_band_taxonomies_slug', 10, 2 ); | |
| /** | |
| * Edit band taxonomy rewrite rule | |
| */ | |
| function theme_band_url_rewrite(){ | |
| add_rewrite_rule( "^artist-releases/([^/]*)$",'index.php?band=$matches[1]','top' ); | |
| flush_rewrite_rules(); | |
| } | |
| add_action( 'admin_init', 'theme_band_url_rewrite' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment