Make WordPress Core


Ignore:
Timestamp:
06/02/2020 05:03:06 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Bundled Themes: Consistently check for WP_Error before outputting get_the_tag_list().

Some themes already had these checks in place as a result of [41756], but not others.

Props sixhours, davidakennedy, SergeyBiryukov.
Fixes #39860.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyten/functions.php

    r47597 r47886  
    631631    function twentyten_posted_in() {
    632632        // Retrieves tag list of current post, separated by commas.
    633         $tag_list = get_the_tag_list( '', ', ' );
    634         if ( $tag_list && ! is_wp_error( $tag_list ) ) {
     633        $tags_list = get_the_tag_list( '', ', ' );
     634
     635        if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    635636            /* translators: 1: Category name, 2: Tag name, 3: Post permalink, 4: Post title. */
    636637            $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' );
     
    642643            $posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
    643644        }
     645
    644646        // Prints the string, replacing the placeholders.
    645647        printf(
    646648            $posted_in,
    647649            get_the_category_list( ', ' ),
    648             $tag_list,
     650            $tags_list,
    649651            get_permalink(),
    650652            the_title_attribute( 'echo=0' )
Note: See TracChangeset for help on using the changeset viewer.