get_template_hierarchy ( $slug, $is_custom = false, $template_prefix = '' )

  • (string) slug The template slug to be created.
  • (bool) is_custom Optional. Indicates if a template is custom or part of the template hierarchy. Default false.
  • (string) template_prefix Optional. The template prefix for the created template. Used to extract the main template type, e.g. in `taxonomy-books` the `taxonomy` is extracted. Default empty string.
  • (string[]) The template hierarchy.
Defined at:


Gets the template hierarchy for the given template slug to be created.Note: Always add `index` as the last fallback template.

Related Functions

get_page_hierarchy, _get_term_hierarchy, get_template_part, get_template_directory, get_template_directory_uri

Top Google Results

User discussions

wpseek mobile