Make WordPress Core


Ignore:
Timestamp:
07/18/2025 03:29:06 AM (6 months ago)
Author:
joedolson
Message:

Bundled Theme: Prevent output of empty title tags.

In Twenty Ten, Twenty Eleven, Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, Twenty Sixteen, Twenty Seventeen, and Twenty Twenty, an empty site title would result in an empty heading and/or an empty link in the site header. These can pollute the heading hierarchy and add a un-named link in screen reader navigation.

Prevent the output of wrapping tags if site title or site description have no value.

Props tsquez, audrasjb, sabernhardt, rehanali, sukhendu2002, dilipbheda, sirlouen, joedolson.
Fixes #44656.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/inc/template-tags.php

    r59907 r60483  
    6464        $classname = $args['logo_class'];
    6565    } else {
     66        if ( ! $site_title ) {
     67            return '';
     68        }
     69
    6670        $contents = sprintf( $args['title'], esc_url( get_home_url( null, '/' ) ), esc_html( $site_title ) );
    6771        if (
Note: See TracChangeset for help on using the changeset viewer.