From fb8478cf6e8d09714b114acc0356b2dd00f96f55 Mon Sep 17 00:00:00 2001 From: David Stone Date: Fri, 17 Apr 2026 10:49:09 -0600 Subject: [PATCH 1/2] fix: fall back to subdomain for blogname when title is empty on duplication When $args->title arrives empty (e.g. via WooCommerce checkout flow), the duplicated site kept the template's blogname instead of the customer's site name. Now falls back to the subdomain portion of the site's domain, ensuring the blogname always reflects the new site. --- inc/helpers/class-site-duplicator.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/inc/helpers/class-site-duplicator.php b/inc/helpers/class-site-duplicator.php index 22f8224c..05de7013 100644 --- a/inc/helpers/class-site-duplicator.php +++ b/inc/helpers/class-site-duplicator.php @@ -323,9 +323,14 @@ protected static function process_duplication($args) { // Ensure the requested title is applied after duplication, since the // table copy may overwrite the blogname option set during site creation. - if (! empty($args->title)) { - update_blog_option($args->to_site_id, 'blogname', $args->title); - } + // When no title was provided (e.g. WooCommerce checkout flow), fall back + // to the subdomain portion of the site's domain so the duplicated site + // doesn't keep the template's blogname. + $new_title = ! empty($args->title) + ? $args->title + : preg_replace('/\..*$/', '', $args->domain); + + update_blog_option($args->to_site_id, 'blogname', $new_title); /** * Allow developers to hook after a site duplication happens. From de0f04173c079eb417b38940dfe6fb0667dfbcae Mon Sep 17 00:00:00 2001 From: David Stone Date: Fri, 17 Apr 2026 11:10:54 -0600 Subject: [PATCH 2/2] fix: ucfirst blogname fallback so cloned sites get a capitalised subdomain title When $args->title is empty (e.g. WooCommerce checkout flow), the fallback now produces 'Ikenabazan' instead of 'ikenabazan'. --- inc/helpers/class-site-duplicator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/helpers/class-site-duplicator.php b/inc/helpers/class-site-duplicator.php index 05de7013..381b7821 100644 --- a/inc/helpers/class-site-duplicator.php +++ b/inc/helpers/class-site-duplicator.php @@ -328,7 +328,7 @@ protected static function process_duplication($args) { // doesn't keep the template's blogname. $new_title = ! empty($args->title) ? $args->title - : preg_replace('/\..*$/', '', $args->domain); + : ucfirst(preg_replace('/\..*$/', '', $args->domain)); update_blog_option($args->to_site_id, 'blogname', $new_title);