A WordPress-centric search engine for devs and theme authors



get_page_templates ›

Since1.5.0
Deprecatedn/a
get_page_templates ( $post = null, $post_type = 'page' )
Parameters: (2)
  • (WP_Post|null) $post Optional. The post being edited, provided for context.
    Required: No
    Default: null
  • (string) $post_type Optional. Post type to get the templates for. Default 'page'.
    Required: No
    Default: 'page'
Returns:
  • (array) Key is the template name, value is the filename of the template
Defined at:
Codex:
Change Log:
  • 4.7.0

Get the Page Templates available in this theme



Source

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