Make WordPress Core

Ticket #17788: get_query_template-filter.patch

File get_query_template-filter.patch, 705 bytes (added by 5ubliminal, 13 years ago)

The improvement.

  • theme.php

     
    745745        if ( empty( $templates ) )
    746746                $templates = array("{$type}.php");
    747747
     748        /**
     749         * Allow the use of one major filter named 'query_template'.
     750         * Only if the returned value is an array() will it be used to replace previous array().
     751         * This is to prevent accidental returns of NULLs or such.
     752         */
     753        is_array( $new_templates = apply_filters( "query_template", $templates, $type ) ) and
     754                !empty( $new_templates ) and ( $templates = $new_templates );
     755       
    748756        return apply_filters( "{$type}_template", locate_template( $templates ) );
    749757}
    750758