Skip to content

fix: fall back to subdomain for blogname when title is empty on duplication#895

Merged
superdav42 merged 2 commits intomainfrom
bugfix/blogname-fallback
Apr 17, 2026
Merged

fix: fall back to subdomain for blogname when title is empty on duplication#895
superdav42 merged 2 commits intomainfrom
bugfix/blogname-fallback

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

Summary

  • Bug: When $args->title is empty during site duplication (happens via WooCommerce checkout flow), the conditional on line 326 skipped the update_blog_option call entirely, leaving the duplicated site with the template's blogname (e.g. "Plantilla Belleza") instead of the customer's site name.
  • Fix: Always call update_blog_option — when title is empty, fall back to the subdomain portion of the site's domain (e.g. ikenabazan from ikenabazan.example.com).
  • Impact: Customer-facing emails were going out with the template name as subject prefix. Confirmed on client sites 299 (ikenabazan) and 307 (fomenthy).

Changes

inc/helpers/class-site-duplicator.php — replaced the if (!empty) guard with a ternary that falls back to preg_replace('/\..*$/', '', $args->domain), ensuring blogname is always set to something meaningful after duplication.

…cation

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.
@superdav42 superdav42 added the origin:interactive Created by interactive user session label Apr 17, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 2 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 2 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6175a040-e578-4f2b-a8eb-816e99005b24

📥 Commits

Reviewing files that changed from the base of the PR and between 0740498 and de0f041.

📒 Files selected for processing (1)
  • inc/helpers/class-site-duplicator.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/blogname-fallback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Performance Test Results

Performance test results for 4006dbc are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 41 37.83 MB 860.50 ms (+19.00 ms / +2% ) 150.50 ms (-5.50 ms / -4% ) 1064.00 ms 2058.00 ms 1954.55 ms (-43.40 ms / -2% ) 92.65 ms (+3.30 ms / +4% )
1 56 49.03 MB 949.00 ms 141.50 ms 1092.00 ms 2098.00 ms 2018.35 ms 79.80 ms

…omain title

When $args->title is empty (e.g. WooCommerce checkout flow), the fallback
now produces 'Ikenabazan' instead of 'ikenabazan'.
@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit 742b58c into main Apr 17, 2026
11 checks passed
@superdav42 superdav42 deleted the bugfix/blogname-fallback branch April 17, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

origin:interactive Created by interactive user session

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant