Make WordPress Core

Opened 6 years ago

Closed 18 months ago

#8722 closed defect (bug) (fixed)

get_categories allows custom taxos, get_category doesn't

Reported by: Malaiac Owned by: ryan
Milestone: 3.7 Priority: normal
Severity: normal Version: 2.7
Component: Taxonomy Keywords: has-patch commit
Focuses: Cc:


get_categories('type=link') works with custom taxonomies (since http://trac.wordpress.org/ticket/7427 ).
get_category('... ?') doesn't.
get_category > get_term($category,'category');

Because of that, all category dependent functions, like wp_list_categories and such, are broken when working with non post categories. get_category doesn't even work with link categories.

Attachments (3)

8722.diff (991 bytes) - added by wojtek.szkutnik 5 years ago.
8722.2.diff (941 bytes) - added by wonderboymusic 20 months ago.
8722.3.diff (3.2 KB) - added by wonderboymusic 19 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 @ryan5 years ago

  • Milestone changed from 2.9 to Future Release

@wojtek.szkutnik5 years ago

comment:2 @wojtek.szkutnik5 years ago

  • Cc wojtek.szkutnik@… added
  • Keywords has-patch needs-testing added; custom-taxonomies removed

Hm, shouldn't all these functions use wp_get_args instead of separate arguments?

comment:3 @wojtek.szkutnik5 years ago

  • Keywords gsoc added

@wonderboymusic20 months ago

comment:4 @wonderboymusic20 months ago

  • Keywords needs-testing gsoc removed
  • Milestone changed from Future Release to 3.7

This is harmless, but might not be necessary. Let us discuss.

comment:5 @DrewAPicture20 months ago

  • Cc xoodrew@… added

comment:6 @nacin19 months ago

It might make more sense to convert all uses of get_category() to get_term(), in functions like wp_list_categories() that are generic and take a taxonomy argument. Otherwise this change doesn't actually help, unless you use the filter, which is very confusing.

@wonderboymusic19 months ago

comment:7 @wonderboymusic19 months ago

  • Keywords commit added

It might make more sense to convert all uses of get_category() to get_term()

Yes, and it actually removes the need for _make_cat_compat() in the functions that are only looking for one property. .3.diff does this.

comment:8 @wonderboymusic18 months ago

  • Resolution set to fixed
  • Status changed from new to closed

In 25662:

Rather than adding a taxonomy arg to get_category(), convert all uses of get_category() in core to get_term(). By doing so, we negate the need to call _make_cat_compat() in a few places that are only looking for a single property.

Fixes #8722.

Note: See TracTickets for help on using tickets.