WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 20 months ago

#21200 new defect (bug)

get_all_category_ids() only used by a deprecated function

Reported by: Latz Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 3.4.1
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

The function "get_all_category_ids()" (category.php) is only used by the deprecated function "get_category_children". I got two ideas for the future of the function:

a) also deprecate it

b) create a function "get_all_taxonomy_ids($taxonomy)". Since it seems to be a common problem for programmers to get e.g. all tag ids I would prefer this.


Attachments (1)

21200.patch (1.6 KB) - added by winterDev 21 months ago.
Hi guys-- here's a patch file, would appreciate if someone could skim it quickly to make sure I did it correctly.

Download all attachments as: .zip

Change History (3)

comment:1 scribu22 months ago

  • Keywords needs-patch added

The actual querying of the ids is done via get_terms() anyway:

$cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );

The only benefit of get_all_category_ids() is that it caches the ids. However, that cache doesn't seem to be invalidated anywhere, so it's buggy.

Therefore, I say we deprecate it.

winterDev21 months ago

Hi guys-- here's a patch file, would appreciate if someone could skim it quickly to make sure I did it correctly.

comment:2 wonderboymusic20 months ago

the function is simplified here: #21760, although not completely deprecated

Note: See TracTickets for help on using tickets.