WordPress.org

Make WordPress Core

Ticket #22956: 22956.2.diff

File 22956.2.diff, 647 bytes (added by scribu, 5 years ago)
  • wp-includes/template.php

    diff --git wp-includes/template.php wp-includes/template.php
    index d86a677..541dccd 100644
    function get_404_template() { 
    5959 * @return string
    6060 */
    6161function get_archive_template() {
    62         $post_types = get_query_var( 'post_type' );
     62        $post_types = (array) get_query_var( 'post_type' );
    6363
    6464        $templates = array();
    6565
    66         foreach ( (array) $post_types as $post_type )
     66        if ( count( $post_types ) == 1 ) {
     67                $post_type = reset( $post_types );
    6768                $templates[] = "archive-{$post_type}.php";
     69        }
    6870        $templates[] = 'archive.php';
    6971
    7072        return get_query_template( 'archive', $templates );