Make WordPress Core

Changeset 57991


Ignore:
Timestamp:
04/14/2024 09:55:32 PM (6 weeks ago)
Author:
SergeyBiryukov
Message:

Twenty Twenty-One: Check for WP_Error before outputting get_the_tag_list().

This prevents a fatal error on PHP 8 and brings consistency with the other bundled themes.

Follow-up to [47886].

Props josephscott, sabernhardt, poena, nirav7707, devsahadat.
Fixes #60800.

File:
1 edited

Legend:

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

    r53399 r57991  
    111111
    112112                $tags_list = get_the_tag_list( '', wp_get_list_item_separator() );
    113                 if ( $tags_list ) {
     113                if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    114114                    printf(
    115115                        /* translators: %s: List of tags. */
     
    153153
    154154                $tags_list = get_the_tag_list( '', wp_get_list_item_separator() );
    155                 if ( $tags_list ) {
     155                if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    156156                    printf(
    157157                        /* translators: %s: List of tags. */
Note: See TracChangeset for help on using the changeset viewer.