Changeset 48665
- Timestamp:
- 07/28/2020 03:40:35 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r48664 r48665 542 542 if ( 'delete_term' === $cap 543 543 && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id 544 || get_option( 'default_t axonomy_' . $term->taxonomy ) == $term->term_id )544 || get_option( 'default_term_' . $term->taxonomy ) == $term->term_id ) 545 545 ) { 546 546 $caps[] = 'do_not_allow'; -
trunk/src/wp-includes/post.php
r48664 r48665 4062 4062 4063 4063 if ( empty( $postarr['tax_input'][ $taxonomy ] ) ) { 4064 $default_term_id = get_option( 'default_t axonomy_' . $taxonomy );4064 $default_term_id = get_option( 'default_term_' . $taxonomy ); 4065 4065 if ( ! empty( $default_term_id ) ) { 4066 4066 $postarr['tax_input'][ $taxonomy ] = array( (int) $default_term_id ); -
trunk/src/wp-includes/taxonomy.php
r48664 r48665 445 445 $term = term_exists( $taxonomy_object->default_term['name'], $taxonomy ); 446 446 if ( $term ) { 447 update_option( 'default_t axonomy_' . $taxonomy_object->name, $term['term_id'] );447 update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] ); 448 448 } else { 449 449 $term = wp_insert_term( … … 458 458 // Update `term_id` in options. 459 459 if ( ! is_wp_error( $term ) ) { 460 update_option( 'default_t axonomy_' . $taxonomy_object->name, $term['term_id'] );460 update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] ); 461 461 } 462 462 } … … 509 509 // Remove custom taxonomy default term option. 510 510 if ( ! empty( $taxonomy_object->default_term ) ) { 511 delete_option( 'default_t axonomy_' . $taxonomy_object->name );511 delete_option( 'default_term_' . $taxonomy_object->name ); 512 512 } 513 513 … … 1835 1835 $taxonomy_object = get_taxonomy( $taxonomy ); 1836 1836 if ( ! empty( $taxonomy_object->default_term ) ) { 1837 $defaults['default'] = (int) get_option( 'default_t axonomy_' . $taxonomy );1837 $defaults['default'] = (int) get_option( 'default_term_' . $taxonomy ); 1838 1838 if ( $defaults['default'] === $term ) { 1839 1839 return 0; -
trunk/tests/phpunit/tests/taxonomy.php
r48480 r48665 1002 1002 // Test default category. 1003 1003 $term = wp_get_post_terms( $post_id, $tax ); 1004 $this->assertSame( get_option( 'default_t axonomy_' . $tax ), $term[0]->term_id );1004 $this->assertSame( get_option( 'default_term_' . $tax ), $term[0]->term_id ); 1005 1005 1006 1006 // Test default term deletion. … … 1021 1021 ); 1022 1022 $term = wp_get_post_terms( $post_id, $tax ); 1023 $this->assertSame( get_option( 'default_t axonomy_' . $tax ), $term[0]->term_id );1023 $this->assertSame( get_option( 'default_term_' . $tax ), $term[0]->term_id ); 1024 1024 1025 1025 // wp_set_object_terms shouldn't assign default category. … … 1029 1029 1030 1030 unregister_taxonomy( $tax ); 1031 $this->assertSame( get_option( 'default_t axonomy_' . $tax ), false );1031 $this->assertSame( get_option( 'default_term_' . $tax ), false ); 1032 1032 } 1033 1033 }
Note: See TracChangeset
for help on using the changeset viewer.