mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 07:36:58 +00:00
Taxonomy queries and urls. Props andy. see #6357
git-svn-id: https://develop.svn.wordpress.org/trunk@7491 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -145,11 +145,20 @@ function is_taxonomy_hierarchical($taxonomy) {
|
||||
* @param array|string $args See above description for the two keys values.
|
||||
*/
|
||||
function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||
global $wp_taxonomies;
|
||||
global $wp_taxonomies, $wp_rewrite;
|
||||
|
||||
$defaults = array('hierarchical' => false, 'update_count_callback' => '');
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
|
||||
if ( !empty( $args['rewrite'] ) ) {
|
||||
if ( !is_array($args['rewrite']) )
|
||||
$args['rewrite'] = array();
|
||||
if ( !isset($args['rewrite']['slug']) )
|
||||
$args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy);
|
||||
$wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', "taxonomy=$taxonomy&term=");
|
||||
$wp_rewrite->add_permastruct("{$args['rewrite']['slug']}/%$taxonomy%");
|
||||
}
|
||||
|
||||
$args['name'] = $taxonomy;
|
||||
$args['object_type'] = $object_type;
|
||||
$wp_taxonomies[$taxonomy] = (object) $args;
|
||||
|
||||
Reference in New Issue
Block a user