WordPress.org

Make WordPress Core

Ticket #13239: 13239.6.diff

File 13239.6.diff, 1.3 KB (added by coffee2code, 6 years ago)

Refreshed my latest patch to cleanly apply against trunk.

  • wp-includes/template.php

     
    342342 * inherit from a parent theme can just overload one file.
    343343 *
    344344 * @since 2.7.0
     345 * @uses apply_filters() Calls 'locate_template' filter on array of template names.
    345346 *
    346347 * @param string|array $template_names Template file(s) to search for, in order.
    347348 * @param bool $load If true the template file will be loaded if it is found.
     
    349350 * @return string The template filename if one is located.
    350351 */
    351352function locate_template($template_names, $load = false, $require_once = true ) {
     353        $template_names = apply_filters( 'locate_template', $template_names, $load, $require_once );
     354
    352355        $located = '';
    353356        foreach ( (array) $template_names as $template_name ) {
    354357                if ( !$template_name )
    355358                        continue;
    356                 if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
     359                if ( path_is_absolute( $template_name ) && file_exists( $template_name ) ) {
     360                        $located = $template_name;
     361                        break;
     362                } else if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
    357363                        $located = STYLESHEETPATH . '/' . $template_name;
    358364                        break;
    359365                } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {