[wp-trac] [WordPress Trac] #7427: get_categories does not allow exernal taxonomy types

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 29 11:19:37 GMT 2008


#7427: get_categories does not allow exernal taxonomy types
---------------------+------------------------------------------------------
 Reporter:  Malaiac  |       Owner:  anonymous 
     Type:  defect   |      Status:  new       
 Priority:  normal   |   Milestone:            
Component:  General  |     Version:            
 Severity:  minor    |    Keywords:  categories
---------------------+------------------------------------------------------
 {{{

 /*
 wp-includes/category.php
 */
 function &get_categories($args = '') {
         $defaults = array('type' => 'category');
         $args = wp_parse_args($args, $defaults);

         $taxonomy = 'category';
         if ( 'link' == $args['type'] )
                 $taxonomy = 'link_category';
         $categories = get_terms($taxonomy, $args);

         foreach ( array_keys($categories) as $k )
                 _make_cat_compat($categories[$k]);

         return $categories;
 }

 }}}


 should be :


 {{{

 function &get_categories($args = '') {
         $defaults = array('type' => 'category');
         $args = wp_parse_args($args, $defaults);

         $taxonomy = 'category';
         global $wp_taxonomies;
         if($args['type'] && $wp_taxonomies[$args['type']])
                 $taxonomy = $args['type'];

         $categories = get_terms($taxonomy, $args);

         foreach ( array_keys($categories) as $k )
                 _make_cat_compat($categories[$k]);

         return $categories;
 }

 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7427>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list