Make WordPress Core


Ignore:
Timestamp:
09/06/2013 10:06:40 PM (11 years ago)
Author:
wonderboymusic
Message:

Ensure that the post type object is the queried object when a post type has been registered with has_archive => true. Ensure it is not stomped when decorated with tax_query. Adds unit tests.

Props nacin.
Fixes #18614.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/template.php

    r23665 r25291  
    7171
    7272    return get_query_template( 'archive', $templates );
     73}
     74
     75/**
     76 * Retrieve path of post type archive template in current or parent template.
     77 *
     78 * @since 3.7.0
     79 *
     80 * @return string
     81 */
     82function get_post_type_archive_template() {
     83    $obj = get_post_type_object( get_query_var( 'post_type' ) );
     84    if ( ! $obj->has_archive )
     85        return '';
     86
     87    return get_archive_template();
    7388}
    7489
Note: See TracChangeset for help on using the changeset viewer.