Skip to content

Commit c0a97bc

Browse files
Copilotswissspidy
andcommitted
Improve error messages and auto-generated slug naming
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 8a75d2d commit c0a97bc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

features/site-create.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Feature: Create a new site on a WP multisite
169169
When I try `wp site create --site-url=http://123.example.com`
170170
Then STDERR should be:
171171
"""
172-
Error: Could not derive a valid slug from the domain. Please provide --slug explicitly.
172+
Error: Could not derive a valid slug from the domain (numeric-only or empty slugs are not allowed). Please provide --slug explicitly.
173173
"""
174174
And the return code should be 1
175175

src/Site_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public function create( $args, $assoc_args ) {
471471

472472
// Validate that the derived base is suitable for use as a slug
473473
if ( empty( $base ) || is_numeric( $base ) ) {
474-
WP_CLI::error( 'Could not derive a valid slug from the domain. Please provide --slug explicitly.' );
474+
WP_CLI::error( 'Could not derive a valid slug from the domain (numeric-only or empty slugs are not allowed). Please provide --slug explicitly.' );
475475
}
476476
} else {
477477
// For subdirectory installs, use the path as the base
@@ -483,7 +483,7 @@ public function create( $args, $assoc_args ) {
483483
}
484484
// If base is empty (root path), generate an auto slug
485485
if ( empty( $base ) ) {
486-
$base = 'auto-' . time();
486+
$base = 'site-' . time();
487487
}
488488
}
489489
} else {

0 commit comments

Comments
 (0)