wpseek.com
A WordPress-centric search engine for devs and theme authors



get_page_templates › WordPress Function

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:
  • (string[]) Array of template file names keyed by the template header name.
Defined at:
Codex:
Change Log:
  • 4.7.0

Gets 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 ) );
}