[wp-trac] [WordPress Trac] #55887: Calling get_terms() with exact same args (most important is exclude_tree) returns unexpected results from runtime cache (second call)

WordPress Trac noreply at wordpress.org
Wed Jun 1 07:19:48 UTC 2022


#55887: Calling get_terms() with exact same args (most important is exclude_tree)
returns unexpected results from runtime cache (second call)
--------------------------+-----------------------------
 Reporter:  szaqal21      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  6.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Calling get_terms() with exact same args (most important is exclude_tree)
 returns unexpected results from runtime cache (second call).

 Test case:
 1. Create some terms ex. in category tax
 ->Bez kategorii
 ->A (term_id: 110)
 -->A1
 ->B (term_id: 111)
 -->B1
 ->C (term_id: 112)
 -->C1
 2. Then call get_terms() two times:

 {{{
 echo 'exclude B tree<br>';
 var_dump(get_terms(array('taxonomy' => 'category', 'exclude_tree' =>
 array(111), 'hide_empty' => false, 'fields' => 'names')));

 echo '<br>2 exclude B tree<br>';
 var_dump(get_terms(array('taxonomy' => 'category', 'exclude_tree' =>
 array(111), 'hide_empty' => false, 'fields' => 'names')));
 }}}
 results:

 {{{
 exclude B tree
 array(5) { [0]=> string(1) "A" [1]=> string(2) "A1" [2]=> string(13) "Bez
 kategorii" [3]=> string(1) "C" [4]=> string(2) "C1" }
 2 exclude B tree
 array(0) { }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55887>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list