[wp-trac] [WordPress Trac] #21378: get_the_category doesn't work for custom post types with custom taxonomies

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 25 16:42:18 UTC 2012


#21378: get_the_category doesn't work for custom post types with custom taxonomies
--------------------------------------+-----------------------
 Reporter:  tcattitude                |       Owner:
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:
Component:  Taxonomy                  |     Version:  3.4.1
 Severity:  normal                    |  Resolution:
 Keywords:  2nd-opinion dev-feedback  |
--------------------------------------+-----------------------
Changes (by tcattitude):

 * keywords:  close => 2nd-opinion dev-feedback
 * status:  closed => reopened
 * resolution:  invalid =>
 * type:  defect (bug) => enhancement


Comment:

 Maybe i just post this as an enhancement instead.

 I talking about this:
 http://wordpress.org/support/topic/get-the-category-not-working-for-
 custom-post-type?replies=5#post-3013294

 {{{
 function get_the_category_bytax( $id = false, $tcat = 'category' ) {
     $categories = get_the_terms( $id, $tcat );
     if ( ! $categories )
         $categories = array();

     $categories = array_values( $categories );

     foreach ( array_keys( $categories ) as $key ) {
         _make_cat_compat( $categories[$key] );
     }

     // Filter name is plural because we return alot of categories
 (possibly more than #13237) not just one
     return apply_filters( 'get_the_categories', $categories );
 }
 }}}

 But for the default "get_the_category".

 Hope this can be reconsidered.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21378#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list