Skip to content

Multisite, Settings: Prevent saving an empty site title or network title via admin screens - #12706

Draft
himanshupathak95 wants to merge 7 commits into
WordPress:trunkfrom
himanshupathak95:fix/65718-multisite-blogname-required-on-edit
Draft

Multisite, Settings: Prevent saving an empty site title or network title via admin screens#12706
himanshupathak95 wants to merge 7 commits into
WordPress:trunkfrom
himanshupathak95:fix/65718-multisite-blogname-required-on-edit

Conversation

@himanshupathak95

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 27, 2026 08:06
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents administrators from saving an empty Site Title (blogname) or Network Title (site_name) through the relevant admin screens, aligning edit behavior with creation-time requirements (notably in Multisite).

Changes:

  • Add server-side validation in sanitize_option() to reject empty/whitespace-only blogname updates (retaining the stored value and registering a settings error).
  • Mark Site Title / Network Title inputs as required in the General Settings and Network Settings forms.
  • In Multisite site settings, carry sanitize_option() settings errors across the redirect to display an error notice instead of a success message.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/wp-includes/formatting.php Rejects empty Site Title updates during option sanitization and registers a settings error.
src/wp-admin/options-general.php Marks “Site Title” as a required field in the General Settings UI.
src/wp-admin/network/site-settings.php Persists settings errors across redirect and displays error notices when site options aren’t saved.
src/wp-admin/network/settings.php Prevents saving an empty Network Title, shows an error notice, and marks the field as required.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wp-admin/network/settings.php
Comment thread src/wp-admin/network/settings.php
Comment thread src/wp-admin/network/site-settings.php
Comment thread src/wp-includes/formatting.php
Copilot AI review requested due to automatic review settings July 27, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/wp-includes/formatting.php:5003

  • This change introduces new behavior for sanitize_option( 'blogname', ... ) (rejecting empty/whitespace-only values and registering a settings error), but there’s no PHPUnit coverage asserting the new validation and the expected get_settings_errors( 'blogname' ) result. Adding a unit test will help prevent regressions in both the returned value (should remain the previously stored option) and the presence/content of the settings error.
				// The site title (blogname) cannot be empty.
				if ( 'blogname' === $option && '' === trim( $value ) ) {
					$error = __( 'The site title cannot be empty. Please enter a title for your site.' );
				}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants