Ticket #22956: 22956.3.diff

File 22956.3.diff, 663 bytes (added by scribu, 5 months ago)
Line 
1diff --git wp-includes/template.php wp-includes/template.php
2index d86a677..99d0046 100644
3--- wp-includes/template.php
4+++ wp-includes/template.php
5@@ -59,12 +59,14 @@ function get_404_template() {
6  * @return string
7  */
8 function get_archive_template() {
9-       $post_types = get_query_var( 'post_type' );
10+       $post_types = array_filter( (array) get_query_var( 'post_type' ) );
11 
12        $templates = array();
13 
14-       foreach ( (array) $post_types as $post_type )
15+       if ( count( $post_types ) == 1 ) {
16+               $post_type = reset( $post_types );
17                $templates[] = "archive-{$post_type}.php";
18+       }
19        $templates[] = 'archive.php';
20 
21        return get_query_template( 'archive', $templates );