Taxonomy: Rename the `default_taxonomy_$taxonomy` option key to `default_term_$taxonomy`.

This better reflects the purpose of the option.

Follow-up to [48356], [48480].

See #43517.
Built from https://develop.svn.wordpress.org/trunk@48665


git-svn-id: http://core.svn.wordpress.org/trunk@48427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-07-28 15:42:07 +00:00
parent 38e6367808
commit 3da046e1bc
4 changed files with 7 additions and 7 deletions

View File

@ -541,7 +541,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
if ( 'delete_term' === $cap
&& ( get_option( 'default_' . $term->taxonomy ) == $term->term_id
|| get_option( 'default_taxonomy_' . $term->taxonomy ) == $term->term_id )
|| get_option( 'default_term_' . $term->taxonomy ) == $term->term_id )
) {
$caps[] = 'do_not_allow';
break;

View File

@ -4061,7 +4061,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
}
if ( empty( $postarr['tax_input'][ $taxonomy ] ) ) {
$default_term_id = get_option( 'default_taxonomy_' . $taxonomy );
$default_term_id = get_option( 'default_term_' . $taxonomy );
if ( ! empty( $default_term_id ) ) {
$postarr['tax_input'][ $taxonomy ] = array( (int) $default_term_id );
}

View File

@ -444,7 +444,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
if ( ! empty( $taxonomy_object->default_term ) ) {
$term = term_exists( $taxonomy_object->default_term['name'], $taxonomy );
if ( $term ) {
update_option( 'default_taxonomy_' . $taxonomy_object->name, $term['term_id'] );
update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] );
} else {
$term = wp_insert_term(
$taxonomy_object->default_term['name'],
@ -457,7 +457,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
// Update `term_id` in options.
if ( ! is_wp_error( $term ) ) {
update_option( 'default_taxonomy_' . $taxonomy_object->name, $term['term_id'] );
update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] );
}
}
}
@ -508,7 +508,7 @@ function unregister_taxonomy( $taxonomy ) {
// Remove custom taxonomy default term option.
if ( ! empty( $taxonomy_object->default_term ) ) {
delete_option( 'default_taxonomy_' . $taxonomy_object->name );
delete_option( 'default_term_' . $taxonomy_object->name );
}
// Remove the taxonomy.
@ -1834,7 +1834,7 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
// Don't delete the default custom taxonomy term.
$taxonomy_object = get_taxonomy( $taxonomy );
if ( ! empty( $taxonomy_object->default_term ) ) {
$defaults['default'] = (int) get_option( 'default_taxonomy_' . $taxonomy );
$defaults['default'] = (int) get_option( 'default_term_' . $taxonomy );
if ( $defaults['default'] === $term ) {
return 0;
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-beta4-48664';
$wp_version = '5.5-beta4-48665';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.