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

git-svn-id: http://svn.automattic.com/wordpress/trunk@12791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-21 22:25:16 +00:00
parent fa4b646642
commit 141583e4c6
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;