Actually, after thinking about this a bit more, we should be able to change the category structure without modifying core code using something like the following (put in your functions.php):
function kb_modify_category_taxonomy() { // get the arguments of the already-registered taxonomy $kb_category_args = get_taxonomy( 'kbe_taxonomy' ); // retus an object // make changes to the args $kb_category_args->show_admin_column = true; $kb_category_args->rewrite['slug'] = 'collections'; //change this to your category structure $kb_category_args->rewrite['with_front'] = true; // re-register the taxonomy register_taxonomy( 'kbe_taxonomy', 'kbe_knowledgebase', (array) $kb_category_args );
}
// hook it up to 11 so that it overrides the original register_taxonomy function
add_action( 'init', 'kb_modify_category_taxonomy', 11 );
The above example will change the category structure from:
mysite.com/knowledgebase_category/general
to
mysite.com/collections/general
Likewise, if you wanted to change the tag structure:
function kb_modify_tag_taxonomy() { // get the arguments of the already-registered taxonomy $kb_tag_args = get_taxonomy( 'kbe_tags' ); // retus an object // make changes to the args $kb_tag_args->show_admin_column = true; $kb_tag_args->rewrite['slug'] = 'kb-topics'; // change to your tag structure of choice $kb_tag_args->rewrite['with_front'] = true; // re-register the taxonomy register_taxonomy( 'kbe_tags', 'kbe_knowledgebase', (array) $kb_tag_args );
}
// hook it up to 11 so that it overrides the original register_taxonomy function
add_action( 'init', 'kb_modify_tag_taxonomy', 11 );
The above example will change the tag structure from:
mysite.com/knowledgebase_tags/general
to
mysite.com/kb-topics/general
*Important: Make sure to re-save your permalink structure after adding the snippet(s).
WordPress ...
ما را در سایت WordPress دنبال می کنید
برچسب : نویسنده : استخدام کار wpss بازدید : 220 تاريخ : سه شنبه 8 تير 1395 ساعت: 17:54