get_template_hierarchy
get_template_hierarchy ( $slug, $is_custom = false, $template_prefix = '' )
Parameters:- (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.
Returns:- (string[]) The template hierarchy.
Defined at: - Introduced in WordPress: 6.1.0
- Deprecated in WordPress: —
Description
Gets the template hierarchy for the given template slug to be created.Note: Always add `index` as the last fallback template.