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:
parent
e5b9ba2a92
commit
b9457ce8ff
@ -185,8 +185,10 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
|||||||
$args['rewrite'] = array();
|
$args['rewrite'] = array();
|
||||||
if ( !isset($args['rewrite']['slug']) )
|
if ( !isset($args['rewrite']['slug']) )
|
||||||
$args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy);
|
$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_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;
|
$args['name'] = $taxonomy;
|
||||||
|
Loading…
Reference in New Issue
Block a user