[wp-trac] [WordPress Trac] #64090: Unexpected DB query when inserting a non-hierarchical term

WordPress Trac noreply at wordpress.org
Fri Oct 10 13:41:50 UTC 2025


#64090: Unexpected DB query when inserting a non-hierarchical term
-------------------------------------------------+-------------------------
 Reporter:  Chouby                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  4.9
Component:  Taxonomy                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-unit-tests good-   |     Focuses:
  first-bug                                      |  performance
-------------------------------------------------+-------------------------
Changes (by spacedmonkey):

 * keywords:   => needs-patch needs-unit-tests good-first-bug
 * type:  defect (bug) => enhancement
 * milestone:  Awaiting Review => 4.9


Comment:

 The fix here seems like a simple one.

 Update `clean_taxonomy_cache`.

 {{{#!php
 function clean_taxonomy_cache( $taxonomy ) {
 ...

         // Regenerate cached hierarchy.
         if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
            delete_option( "{$taxonomy}_children" );
            _get_term_hierarchy( $taxonomy );
         }
 ...
 }

 }}}

 Adding a good-first-bug, as this is a quick fix.

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


More information about the wp-trac mailing list