WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 7 weeks ago

#54472 new defect (bug)

Taxonomy: Unregistering taxonomy with default term endlessly regenerates options

Reported by: dlh Owned by:
Milestone: 6.0 Priority: normal
Severity: normal Version: 5.5
Component: Taxonomy Keywords: has-patch
Focuses: performance Cc:

Description

[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().

Change History (4)

#2 @SergeyBiryukov
2 months ago

  • Milestone changed from Awaiting Review to 5.9

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


7 weeks ago

#4 @audrasjb
7 weeks ago

  • Milestone changed from 5.9 to 6.0

Moving this ticket to 6.0 as we're releasing WP 5.9 beta 1.

Note: See TracTickets for help on using tickets.