Skip to content

Commit d960279

Browse files
committed
fix suffix '-' for new author slug
1 parent 986abd7 commit d960279

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/Classes/Admin_Ajax.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,16 @@ public static function handle_author_slug_generation()
342342
$author_slug = !empty($_POST['author_name']) ? sanitize_title($_POST['author_name']) : '';
343343
$generated_slug = $author_slug;
344344
$generated_slug_n = '';
345-
while (get_term_by('slug', $generated_slug .'-' . $generated_slug_n, 'author')) {
345+
346+
$new_slug = $generated_slug;
347+
while (get_term_by('slug', $new_slug, 'author')) {
346348
if ($generated_slug_n == '') {
347349
$generated_slug_n = 1;
348350
} else {
349351
$generated_slug_n++;
350352
}
353+
$new_slug = $generated_slug .'-' . $generated_slug_n;
351354
}
352-
$new_slug = $generated_slug .'-' . $generated_slug_n;
353355
$response['author_slug'] = $new_slug;
354356
}
355357

0 commit comments

Comments
 (0)