Make WordPress Core

Changeset 45719


Ignore:
Timestamp:
08/02/2019 02:32:58 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Twenty Thirteen: Prevent author-bio.php partial template from interfering with rendering an author archive of a user with the bio username.

Props rclations, ianbelanger, lordlod, SergeyBiryukov.
Fixes #32096.

File:
1 edited

Legend:

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

    r45675 r45719  
    785785add_filter( 'widget_tag_cloud_args', 'twentythirteen_widget_tag_cloud_args' );
    786786
     787/**
     788 * Prevents `author-bio.php` partial template from interfering with rendering
     789 * an author archive of a user with the `bio` username.
     790 *
     791 * @since Twenty Thirteen 3.0
     792 *
     793 * @param string $template Template file.
     794 * @return string Replacement template file.
     795 */
     796function twentythirteen_author_bio_template( $template ) {
     797    if ( is_author() ) {
     798        $author = get_queried_object();
     799        if ( $author instanceof WP_User && 'bio' === $author->user_nicename ) {
     800            return locate_template( array( 'archive.php', 'index.php' ) );
     801        }
     802    }
     803
     804    return $template;
     805}
     806add_filter( 'template_include', 'twentythirteen_author_bio_template' );
     807
    787808if ( ! function_exists( 'wp_body_open' ) ) :
    788809    /**
Note: See TracChangeset for help on using the changeset viewer.