locate_block_template
locate_block_template ( $template, $type, $templates )
Parameters:- (string) template Path to the template. See locate_template().
- (string) type Sanitized filename without extension.
- (string[]) templates A list of template candidates, in descending order of priority.
Returns:- (string) The path to the Site Editor template canvas file, or the fallback PHP template.
Defined at:Change Log: - Introduced in WordPress: 5.8.0
- Deprecated in WordPress: —
Description
Finds a block template with equal or higher specificity than a given PHP template file.Internally, this communicates the block content that needs to be used by the template canvas through a global variable.