[wp-trac] [WordPress Trac] #22956: Unpredictable template loading when multiple post types are involved

WordPress Trac noreply at wordpress.org
Sun Dec 16 00:13:25 UTC 2012


#22956: Unpredictable template loading when multiple post types are involved
--------------------+--------------------------
 Reporter:  scribu  |       Type:  defect (bug)
   Status:  new     |   Priority:  normal
Milestone:  3.5.1   |  Component:  General
  Version:  3.5     |   Severity:  normal
 Keywords:          |
--------------------+--------------------------
 [21861] sought to improve the template loading behaviour when multiple
 post types are involved, but I don't think it was the right approach.

 1. It creates backward-incompatible behaviour:

 Take a query of `'post_type' => array( 'serie', 'post' )`

 In 3.4, `archive.php` always ended up being loaded, since it was unlikely
 for `archive-Array.php` to exist.

 In 3.5, it unexpectedly loads `archive-serie.php`.

 2. Which template gets loaded depends on the order of the post types, i.e.
 `'post_type' => array( 'serie', 'post' )` is different from `'post_type'
 => array( 'post', 'serie' )`.

 Possible alternatives:

 a) always load `archive.php` if 'post_type' is an array.

 b) choose the template based on `get_queried_object()`.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22956>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list