WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#12908 closed enhancement (duplicate)

Introduce get_term_ancestors()

Reported by: scribu Owned by: filosofo
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

We have get_term_children(), but no get_term_ancestors().

It can be used in Core to cut down the queries done by cat_is_ancestor_of() and will be useful in and off itself. Example: #12898 #10277

Attachments (1)

get_term_ancestors.diff (1.7 KB) - added by scribu 9 years ago.
Introduce get_term_ancestors() and use in cat_is_ancestor_of()

Download all attachments as: .zip

Change History (5)

#1 follow-up: @filosofo
9 years ago

See #12443

That's an interesting approach, but I think you're going to eat up all the memory with a decent number of categories.

@scribu
9 years ago

Introduce get_term_ancestors() and use in cat_is_ancestor_of()

#2 @voyagerfan5761
9 years ago

  • Cc WordPress@… added

#3 in reply to: ↑ 1 @scribu
9 years ago

Replying to filosofo:

That's an interesting approach, but I think you're going to eat up all the memory with a decent number of categories.

I don't think that's likely, since only two integer fields are retrieved: ID and parent.

Besides, wp_list_categories() retrieves all the fields for all the categories and I haven't heard any memory limit issues about that.

#4 @scribu
9 years ago

  • Milestone 3.1 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I think #12443 is the better way to go.

Note: See TracTickets for help on using tickets.