mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-10 18:37:58 +01:00
Don't issue dupe slug error if provided slug matches name derived slug. fixes #12349
git-svn-id: http://svn.automattic.com/wordpress/trunk@14839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
de01cfab62
commit
7f96fff66f
@ -1586,9 +1586,11 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
|
||||
$name = stripslashes($name);
|
||||
$description = stripslashes($description);
|
||||
|
||||
$slug_from_name = sanitize_title($name);
|
||||
|
||||
if ( empty($slug) )
|
||||
$slug = sanitize_title($name);
|
||||
elseif ( is_term($slug) )
|
||||
$slug = $slug_from_name;
|
||||
elseif ( is_term($slug) && ( $slug != $slug_from_name ) )
|
||||
return new WP_Error('term_slug_exists', __('A term with the slug provided already exists.'));
|
||||
|
||||
$term_group = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user