From f6f0ac59dc08a220861d2ab7295d89cc748b0eb4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 2 Aug 2019 02:32:35 +0000 Subject: [PATCH] Twenty Fifteen: 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. See #32096. git-svn-id: https://develop.svn.wordpress.org/trunk@45718 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentyfifteen/functions.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wp-content/themes/twentyfifteen/functions.php b/src/wp-content/themes/twentyfifteen/functions.php index 48ad929b5a..d47db9eb50 100644 --- a/src/wp-content/themes/twentyfifteen/functions.php +++ b/src/wp-content/themes/twentyfifteen/functions.php @@ -536,6 +536,27 @@ function twentyfifteen_widget_tag_cloud_args( $args ) { } add_filter( 'widget_tag_cloud_args', 'twentyfifteen_widget_tag_cloud_args' ); +/** + * Prevents `author-bio.php` partial template from interfering with rendering + * an author archive of a user with the `bio` username. + * + * @since Twenty Fifteen 2.6 + * + * @param string $template Template file. + * @return string Replacement template file. + */ +function twentyfifteen_author_bio_template( $template ) { + if ( is_author() ) { + $author = get_queried_object(); + if ( $author instanceof WP_User && 'bio' === $author->user_nicename ) { + return locate_template( array( 'archive.php', 'index.php' ) ); + } + } + + return $template; +} +add_filter( 'template_include', 'twentyfifteen_author_bio_template' ); + /** * Implement the Custom Header feature.