WordPress.org

Make WordPress Core

Changeset 45718


Ignore:
Timestamp:
08/02/2019 02:32:35 AM (2 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r45675 r45718  
    537537add_filter( 'widget_tag_cloud_args', 'twentyfifteen_widget_tag_cloud_args' );
    538538
     539/**
     540 * Prevents `author-bio.php` partial template from interfering with rendering
     541 * an author archive of a user with the `bio` username.
     542 *
     543 * @since Twenty Fifteen 2.6
     544 *
     545 * @param string $template Template file.
     546 * @return string Replacement template file.
     547 */
     548function twentyfifteen_author_bio_template( $template ) {
     549    if ( is_author() ) {
     550        $author = get_queried_object();
     551        if ( $author instanceof WP_User && 'bio' === $author->user_nicename ) {
     552            return locate_template( array( 'archive.php', 'index.php' ) );
     553        }
     554    }
     555
     556    return $template;
     557}
     558add_filter( 'template_include', 'twentyfifteen_author_bio_template' );
     559
    539560
    540561/**
Note: See TracChangeset for help on using the changeset viewer.