Skip to content

Commit a63eeab

Browse files
swissspidyCopilot
andauthored
Update src/Site_Command.php
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c0a97bc commit a63eeab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Site_Command.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@ public function create( $args, $assoc_args ) {
479479
// Use the last part of the path if there are multiple segments
480480
if ( ! empty( $base ) ) {
481481
$path_parts = explode( '/', $base );
482-
$base = $path_parts[ count( $path_parts ) - 1 ];
482+
$last_part = array_pop( $path_parts );
483+
if ( null !== $last_part && '' !== $last_part ) {
484+
$base = $last_part;
485+
}
483486
}
484487
// If base is empty (root path), generate an auto slug
485488
if ( empty( $base ) ) {

0 commit comments

Comments
 (0)