Determines whether the current post uses a page template.
Description
This template tag allows you to determine if you are in a page template.You can optionally provide a template filename or array of template filenames and then the check will be specific to that template. For more information on this and similar theme functions, check out the <a href="https://developer.wordpress.org/themes/basics/conditional-tags/">https://developer.wordpress.org/themes/basics/conditional-tags/</a> Conditional Tags article in the Theme Developer Handbook.
Parameters
$templatestring|string[]optional
The specific template filename or array of templates to match.Default: ''
Return
bool
True on success, false on failure.
Uses · 3
is_singular()Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).
Signature, return type and hooks compared across 5 parsed releases.
4.7.0
Now works with any post type, not just pages.from the docblock
4.2.0
The $template parameter was changed to also accept an array of page templates.from the docblock
2.5.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/post-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.