Add flag to taxonomy registration allowing permalinks to be prepended with front, or not. Props prettyboymp. fixes #11449

git-svn-id: https://develop.svn.wordpress.org/trunk@12791 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-01-21 22:25:16 +00:00
parent e5b9ba2a92
commit b9457ce8ff
1 changed files with 3 additions and 1 deletions

View File

@ -185,8 +185,10 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
$args['rewrite'] = array();
if ( !isset($args['rewrite']['slug']) )
$args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy);
if ( !isset($args['rewrite']['with_front']) )
$args['rewrite']['with_front'] = true;
$wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term");
$wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%");
$wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
}
$args['name'] = $taxonomy;