[wp-trac] [WordPress Trac] #32144: get_terms with child_of

WordPress Trac noreply at wordpress.org
Wed Apr 29 12:45:59 UTC 2015


#32144: get_terms with child_of
--------------------------+--------------------
 Reporter:  shifty51      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.2.2
Component:  General       |     Version:  4.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------
Changes (by boonebgorges):

 * milestone:  Awaiting Review => 4.2.2


Comment:

 Thanks, shifty51!

 I've run some basic tests, and it looks like the performance benefit of
 switching to a keyed array + isset are very dramatic. For sites with a
 large number of terms in a taxonomy hierarchy with three or more terms,
 the difference can be several orders of magnitude. I created about 6000
 terms, made 3000 of them a child of $foo, and then another 1000 a child of
 one of $foo's children. Then I ran `get_terms( array( 'child_of' => $foo,
 'hide_empty' => false ) )`. Results:

 without 32144.diff: 26s
 with 32144.diff: ~0.4s

 Because this problem has a potential to be pretty big on certain sorts of
 sites, and because it was introduced in 4.2, I'm moving to 4.2.x
 consideration.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32144#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list