locate_template ( $template_names, $load = false, $require_once = true )

  • (string|array) $template_names Template file(s) to search for, in order.
  • (bool) $load If true the template file will be loaded if it is found.
  • (bool) $require_once Whether to require_once or require. Default true. Has no effect if $load is false.
  • (string) The template filename if one is located.
Defined at:


Retrieve the name of the highest priority template file that exists.

Searches in the STYLESHEETPATH before TEMPLATEPATH and wp-includes/theme-compat so that themes which inherit from a parent theme can just overload one file.

Related Functions

load_template, get_date_template, get_template, get_category_template, is_page_template

Top Google Results

User discussions

wpseek mobile