WPDev.one
Core Function
View Source on Trac ↗

get_page_templates()

get_page_templates( mixed $post = null, mixed $post_type = 'page' )

Gets the page templates available in this theme.

Parameters 1 required

Name / Type Description
(WP_Post

| null) $post Optional. The post being edited, provided for context.

Required
$post_type
string

Optional. Post type to get the templates for. Default 'page'.

Return Value

(string[])
Array of template file names keyed by the template header name.

Function Information

Since Version
1.5.0
Source File
wp-admin/includes/theme.php
Advertisement