Index: wp-includes/template.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/template.php	(revision 27007)
+++ wp-includes/template.php	(revision )
@@ -453,28 +453,47 @@
  * inherit from a parent theme can just overload one file.
  *
  * @since 2.7.0
+ * @uses apply_filters() Calls 'locate_template' filter on array of template names.
  *
  * @param string|array $template_names Template file(s) to search for, in order.
  * @param bool $load If true the template file will be loaded if it is found.
  * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false.
  * @return string The template filename if one is located.
  */
-function locate_template($template_names, $load = false, $require_once = true ) {
+function locate_template( $template_names, $load = false, $require_once = true ) {
 	$located = '';
+
+	/**
+	 * Filter the array of template names passed to locate_filter().
+	 *
+	 * Returning false will signal to locate_template() to simply return and not load any template.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param string|array $template_names Template file or array of files to search for, in order.
+	 */
+	$template_names = apply_filters( 'locate_template', $template_names );
+
+	if ( false === $template_names )
+		return false;
+
-	foreach ( (array) $template_names as $template_name ) {
+	foreach ( (array)$template_names as $template_name ) {
-		if ( !$template_name )
+		if ( ! $template_name ) {
 			continue;
-		if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
-			$located = STYLESHEETPATH . '/' . $template_name;
+		} else if ( path_is_absolute( $template_name ) && file_exists( $template_name ) ) {
+		 	$located = $template_name;
+		} else if ( file_exists( $filepath = get_stylesheet_directory() . '/' . $template_name ) ) {
+			$located = $filepath;
 			break;
-		} else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
-			$located = TEMPLATEPATH . '/' . $template_name;
+		} else if ( file_exists( $filepath = get_template_directory() . '/' . $template_name ) ) {
+			$located = $filepath;
 			break;
 		}
 	}
 
-	if ( $load && '' != $located )
+	if ( $load && '' != $located ) {
 		load_template( $located, $require_once );
+	}
 
 	return $located;
 }
