| 1189 | $post_name_check = |
| 1190 | $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'inherit' AND ID != '$post_ID' LIMIT 1"); |
| 1191 | |
| 1192 | if ($post_name_check) { |
| 1193 | $suffix = 2; |
| 1194 | while ($post_name_check) { |
| 1195 | $alt_post_name = $post_name . "-$suffix"; |
| 1196 | $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'inherit' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); |
| 1197 | $suffix++; |
| 1198 | } |
| 1199 | $post_name = $alt_post_name; |
| 1200 | } |
| 1201 | |