WordPress.org

Make WordPress Core

Ticket #39860: 39860.1.patch

File 39860.1.patch, 3.0 KB (added by davidakennedy, 3 years ago)

Check for is_wp_error() before outputting get_the_tag_list().

  • src/wp-content/themes/twentyfifteen/inc/template-tags.php

     
    9797                }
    9898
    9999                $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
    100                 if ( $tags_list ) {
     100                if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    101101                        printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    102102                                _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ),
    103103                                $tags_list
  • src/wp-content/themes/twentyseventeen/inc/template-tags.php

     
    8484                                                        echo '<span class="cat-links">' . twentyseventeen_get_svg( array( 'icon' => 'folder-open' ) ) . '<span class="screen-reader-text">' . __( 'Categories', 'twentyseventeen' ) . '</span>' . $categories_list . '</span>';
    8585                                                }
    8686
    87                                                 if ( $tags_list ) {
     87                                                if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    8888                                                        echo '<span class="tags-links">' . twentyseventeen_get_svg( array( 'icon' => 'hashtag' ) ) . '<span class="screen-reader-text">' . __( 'Tags', 'twentyseventeen' ) . '</span>' . $tags_list . '</span>';
    8989                                                }
    9090
  • src/wp-content/themes/twentysixteen/inc/template-tags.php

     
    101101        }
    102102
    103103        $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
    104         if ( $tags_list ) {
     104        if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    105105                printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    106106                        _x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
    107107                        $tags_list
  • src/wp-content/themes/twentyten/functions.php

     
    536536function twentyten_posted_in() {
    537537        // Retrieves tag list of current post, separated by commas.
    538538        $tag_list = get_the_tag_list( '', ', ' );
    539         if ( $tag_list ) {
     539        if ( $tag_list && ! is_wp_error( $tag_list ) ) {
    540540                $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
    541541        } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
    542542                $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );