WPDev.one
Core Function
View Source on Trac ↗

get_template_hierarchy()

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

Gets the template hierarchy for the given template slug to be created.

Parameters 3 required

Name / Type Description
$slug
string

The template slug to be created.

Required
bool

$is_custom Optional. Indicates if a template is custom or part of the template hierarchy. Default false.

Required
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.

Required

Return Value

(string[])
The template hierarchy.

Function Information

Since Version
6.1.0
Source File
wp-includes/block-template-utils.php
Advertisement