Taxonomy: Retain default term option when unregistering taxos.

No longer delete the default term option in `unregister_taxonomy()` to improve database performance.

Since taxonomies are registered at runtime and can't be unregistered unless they're already registered, prior to this 
change the option was created and deleted on each request.

Deleting the option should occur on a one-time opperation such as plugin deactivation.

Follow up to [48480].

Props dlh.
Fixes #54472.

Built from https://develop.svn.wordpress.org/trunk@53669


git-svn-id: http://core.svn.wordpress.org/trunk@53228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-07-06 05:11:12 +00:00
parent 228bbf3f7f
commit 1ace1a4d2b
2 changed files with 1 additions and 6 deletions

View File

@ -580,11 +580,6 @@ function unregister_taxonomy( $taxonomy ) {
$taxonomy_object->remove_rewrite_rules(); $taxonomy_object->remove_rewrite_rules();
$taxonomy_object->remove_hooks(); $taxonomy_object->remove_hooks();
// Remove custom taxonomy default term option.
if ( ! empty( $taxonomy_object->default_term ) ) {
delete_option( 'default_term_' . $taxonomy_object->name );
}
// Remove the taxonomy. // Remove the taxonomy.
unset( $wp_taxonomies[ $taxonomy ] ); unset( $wp_taxonomies[ $taxonomy ] );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53665'; $wp_version = '6.1-alpha-53669';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.