get_page_templates() – Get the Page Templates available in this theme
You appear to be a bot. Output may be restricted
Description
Gets the page templates available in this theme.
Usage
$string[] = get_page_templates( $post, $post_type );
Parameters
- $post
- ( WP_Post|null ) optional – Optional. The post being edited, provided for context.
- $post_type
- ( string ) optional default: page – Optional. Post type to get the templates for. Default 'page'.
Returns
string[] Array of template file names keyed by the template header name.
Source
File name: wordpress/wp-admin/includes/theme.php
Lines:
1 to 3 of 3
function get_page_templates( $post = null, $post_type = 'page' ) { return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) ); }