[wp-trac] [WordPress Trac] #54472: Taxonomy: Unregistering taxonomy with default term endlessly regenerates options

WordPress Trac noreply at wordpress.org
Fri Nov 19 02:38:32 UTC 2021


#54472: Taxonomy: Unregistering taxonomy with default term endlessly regenerates
options
--------------------------+-----------------------------
 Reporter:  dlh           |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  5.5
 Severity:  normal        |   Keywords:  has-patch
  Focuses:  performance   |
--------------------------+-----------------------------
 [48480] added logic to `unregister_taxonomy()` to delete the default term
 option for the taxonomy if it had a default term. This logic causes the
 default term option for the taxonomy to be created and then deleted on
 every request: created when the taxonomy is registered, deleted when the
 taxonomy is unregistered, created again in the next request because it was
 deleted in the previous request, and so on.

 Since taxonomies are registered at runtime and can't be unregistered
 unless they're already registered, the option will necessarily be created
 and deleted within the same request and again on every subsequent request,
 as opposed to a one-time operation like plugin deactivation.

 I can sympathize with the desire to "clean up" the database as part of
 unregistering the taxonomy, but the cost to performance seems
 unnecessarily high in this case. There's also precedent: the
 `{$taxonomy}_children` option isn't deleted when the taxonomy is
 unregistered, either.

 Accordingly, the linked Pull Request would remove the `delete_option()`
 call from `unregister_taxonomy()`.

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


More information about the wp-trac mailing list