diff --git a/wp-includes/taxonomy-functions.php b/wp-includes/taxonomy-functions.php index 8533641a1e..0692f6b833 100644 --- a/wp-includes/taxonomy-functions.php +++ b/wp-includes/taxonomy-functions.php @@ -2516,7 +2516,26 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { * Prevent the creation of terms with duplicate names at the same level of a taxonomy hierarchy, * unless a unique slug has been explicitly provided. */ - if ( $name_match = get_term_by( 'name', $name, $taxonomy ) ) { + $name_matches = get_terms( $taxonomy, array( + 'name' => $name, + 'hide_empty' => false, + ) ); + + /* + * The `name` match in `get_terms()` doesn't differentiate accented characters, + * so we do a stricter comparison here. + */ + $name_match = null; + if ( $name_matches ) { + foreach ( $name_matches as $_match ) { + if ( strtolower( $name ) === strtolower( $_match->name ) ) { + $name_match = $_match; + break; + } + } + } + + if ( $name_match ) { $slug_match = get_term_by( 'slug', $slug, $taxonomy ); if ( ! $slug_provided || $name_match->slug === $slug || $slug_match ) { if ( is_taxonomy_hierarchical( $taxonomy ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 703c632b93..ee45fb830a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34808'; +$wp_version = '4.4-alpha-34809'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.