WordPress at Your Fingertips

get_page_templates() WP 1.0

Get the Page Templates available in this theme

No Hooks.


String[]. Array of template file names keyed by the template header name.


get_page_templates( $post, $post_type );
The post being edited, provided for context.
Default: null
Post type to get the templates for.
Default: 'page'


Since 1.5.0 Introduced.
Since 4.7.0 Added the $post_type parameter.

Code of get_page_templates() WP 5.8.1

function get_page_templates( $post = null, $post_type = 'page' ) {
	return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) );

Other Theme Functions

No comments
    Log In