get_page_templates

Advertisement

Summery Summery

Gets the page templates available in this theme.

Syntax Syntax

get_page_templates( WP_Post|null $post = null, string $post_type = 'page' )

Parameters Parameters

$post

(Optional) The post being edited, provided for context.

Default value: null

$post_type

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

Default value: 'page'

Return Return

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

Source Source

File: wp-admin/includes/theme.php

 *
 * @param WP_Post|null $post      Optional. The post being edited, provided for context.
 * @param string       $post_type Optional. Post type to get the templates for. Default 'page'.

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Added the $post_type parameter.
1.5.0 Introduced.

Advertisement

Leave a Reply