Make WordPress Core

Opened 6 weeks ago

Last modified 3 days ago

#63548 new enhancement

Don't allow empty Blog Name / Site Title

Reported by: presskopp's profile Presskopp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

There should be at least a warning when the Site Title aka Blog Name is empty. Why? Because it's bad for SEO, themes and Screen Readers could fail and so on.

For the Tagline we present a description "In a few words, explain what this site is about. Example: “Just another WordPress site.”, but not for the Site Title, which is far more important.

Attachments (1)

General Settings form with required Site Title and novalidate removed.png (57.4 KB) - added by westonruter 6 weeks ago.

Download all attachments as: .zip

Change History (6)

#1 @rishabhwp
6 weeks ago

Reproduction Report

Description

This report validates whether the issue described above can be reproduced. The issue concerns the ability to save an empty Site Title (also known as Blog Name) without any validation or user warning.

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 137.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-One 2.5
  • MU Plugins: None activated

Actual Results

  1. Navigated to Settings → General
  2. Cleared the Site Title field
  3. Clicked Save Changes
  4. The form saved without any error or warning
  5. The Site Title remained empty after saving
  6. No frontend or admin notices were displayed
  7. The same behavior was confirmed via Appearance → Customize → Site Identity

Additional Notes

  • This behavior can negatively impact SEO, accessibility, and theme rendering
  • Themes often use bloginfo( 'name' ) for document titles, headers, and screen reader landmarks — its absence may cause rendering gaps or a11y issues
  • The Tagline field includes helper text, but the Site Title field does not, which may contribute to user confusion

Supplemental Artifacts

#2 @westonruter
6 weeks ago

Is this a common issue? Who would create a blog without a name? Perhaps if someone doesn't want to show the site name in the header and they can't figure out how to modify the template to remove it?

As for implementation, related to #47595, we could remove the novalidate attribute from the form and add the required attribute to the Site Title field (see attached screenshot).

This ticket was mentioned in PR #8974 on WordPress/wordpress-develop by @sahilgidwani.


5 weeks ago
#4

  • Keywords has-patch added

Trac Ticket: https://core.trac.wordpress.org/ticket/63548

---

This PR introduces a client-side validation mechanism for the Site Title (Blog Name) field on the WordPress General Settings screen (options-general.php). The goal is to ensure that site administrators do not leave the field empty, as this has serious implications for:

  • SEO performance
  • Accessibility (screen readers rely on a proper site name)
  • Theme compatibility and proper display
  • General user experience

Despite the importance of this field, no validation or instructional guidance currently exists.

### Changes Introduced

#### 1. HTML Attribute Update in options-general.php

Added the required attribute to the <input> element for the Site Title field:

<input required name="blogname" type="text" id="blogname" value="<?php form_option( 'blogname' ); ?>" class="regular-text" />

This ensures modern browsers offer native validation out of the box.

#### 2. Custom JavaScript Validation in options.php

Hooked into admin_head via:

add_action( 'admin_head', 'options_general_add_js' );

Then added jQuery-based validation script to provide enhanced UX and fallback behavior.

Key logic implemented:

  • Prevent form submission if Site Title is blank.
  • Append custom error message styled in red under the field.
  • Scroll and focus to the invalid field.
  • Remove error state as soon as the user starts typing.

Validation JS snippet:

$('form').on('submit', function(e) {
    var $blogname = $('#blogname');
    var siteTitle = $.trim($blogname.val());

    $('.site-title-error').remove();
    $blogname.removeClass('form-invalid');

    if (!siteTitle) {
        e.preventDefault();
        $blogname.addClass('form-invalid');
        $blogname.closest('td').append(
            '<p class="site-title-error" style="color: #d63638; margin-top: 5px;">' +
            '<?php esc_html_e( 'Site title is required and cannot be empty.' ); ?>' +
            '</p>'
        );
        $blogname.focus();
        $('html, body').animate({ scrollTop: $blogname.offset().top - 100 }, 500);
        return false;
    }
});

$('#blogname').on('input', function() {
    $('.site-title-error').remove();
    $(this).removeClass('form-invalid');
});

### Why This Is Important

  • No existing warning or guidance is provided for an empty Site Title.
  • The Tagline field includes a descriptive example, but Site Title—being more critical—is left unchecked.
  • The Site Title is a key component in how search engines and screen readers understand and display your site.
  • Misconfigured or empty titles degrade theme outputs and can confuse users.

#5 @sabernhardt
3 days ago

I think the Site Title should be required only when creating a site. Multisite already does that in two places, but single-site installations do not.

If you edit other settings in an old site, and receive an error about a new requirement, that experience would be quite unpleasant.

I have needed to add a missing Site Title for someone, but I disagree that it is necessary for 100% of WordPress sites. Using a block theme, setting a static front page, and/or disabling feeds could mitigate at least most of the related problems.

Also, the admin toolbar has had a fallback since #18197, which shows the domain.


Single-site installations

  • install.php: does not require a site title to create a new site

Any individual sites (either single-site or each site within a network)

  • Customizer → Site Identity: you can publish changes with an empty Site Title field
  • Site Title block: has "Write site title..." placeholder, but you can save with the block empty
  • wp-admin/options-general.php: you can save with empty Site Title
  • wp-admin/options.php: you can empty blogname, but the page clearly warns that "You can break things here."

Multisite

  • wp-signup.php: requires title for new site in network
  • wp-admin/network/site-new.php: requires title for new site
  • wp-admin/network/site-settings.php: you can empty the blogname field
Note: See TracTickets for help on using tickets.