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

WordPress Trac noreply at wordpress.org
Mon Apr 27 08:18:50 UTC 2015


#32144: get_terms with child_of
--------------------------+-----------------------------
 Reporter:  shifty51      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello, I have a problem with the "get_terms" when I use "child_of" since I
 installed version 4.2 of wordpress. The error is as follows

 {{{
 Fatal error: Maximum execution time of 30 seconds exceeded in
 mywebsite.com/wp-includes/taxonomy.php on line 3958.
 }}}

 The term used in 'child of "a lot of childs (More than 800) and up to 2
 levels and is itself a child of another term.
 The line in question is in /wp-includes/taxonomy.php this:

 {{{
 // Do not recurse if we've already APPROBATION the term as a child - this
 Indicates a loop.
 if (in_array ($ term-> term_id, $ ancestors)) {
 continue;
 }
 }}}
 I tried disabling all plugins and activating the twentyfifteen theme,
 simply by adding taxonomy declaration in the function.php file of the
 theme:

 {{{
 / *
  * TAXONOMIES
  * /
 add_action ('init', 'create_dossier_taxonomies', 0);

 create_dossier_taxonomies function () {
   // Add new taxonomy, make it hierarchical (like categories)
   $ Labels = array (
     'Name' => _x ('Folders', 'general taxonomy name'),
     'Singular_name' => _x ('File', 'taxonomy singular name'),
     'Search_items' => __ ('Search Folder')
     'All_items' => __ ('All files')
     'Parent_item' => __ ('directory')
     'Parent_item_colon' => __ ('Parent Folder:')
     'Edit_item' => __ ('Edit File')
     'Update_item' => __ ('Update folder')
     'Add_new_item' => __ ('Add Folder')
     'New_item_name' => __ ('New folder name')
     'Menu_name' => __ ('File')
   );

   $ Args = array (
     'Hierarchical' => true,
     'Label' => $ labels
     'Show_ui' => true,
     'Show_admin_column' => true,
     'Query_var' => true,
     'Rewrite' => array ('slug' => 'file')
   );

   register_taxonomy ('file', array ('post', 'short'), $ args);
   // Add new taxonomy, make it hierarchical (like categories)

 }
 }}}

 When I commented these lines I have no problem. Looking in the version
 4.1.3, I feel that the function in question has been rewritten. It would
 there be a problem with "in_array"?

 Sorry for my english...

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


More information about the wp-trac mailing list