Skip to content

Instantly share code, notes, and snippets.

@wolfthemes
Last active July 25, 2018 12:14
Show Gist options
  • Select an option

  • Save wolfthemes/67fa32f34548c47ed62c472117299e97 to your computer and use it in GitHub Desktop.

Select an option

Save wolfthemes/67fa32f34548c47ed62c472117299e97 to your computer and use it in GitHub Desktop.
Rewrite band taxonomy slug
/**
* 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