Added a comment clarifying the suffix substring when checking slug uniqueness

This commit is contained in:
Christopher Allford 2019-11-20 10:02:34 -08:00 committed by GitHub
parent 55f49ae26a
commit 661f2b7722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -259,6 +259,7 @@ class WC_Admin_Duplicate_Product {
// Find the maximum suffix so we can ensure uniqueness.
$max_suffix = 1;
foreach ( $results as $result ) {
// Pull a numerical suffix off the slug after the last hyphen.
$suffix = intval( substr( $result->post_name, strrpos( $result->post_name, '-' ) + 1 ) );
if ( $suffix > $max_suffix ) {
$max_suffix = $suffix;