WP_Theme::get_page_templates

SummerySummery

Returns the theme’s post templates for a given post type.

Syntax

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

ParametersParameters

$post

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

Default value: null

$post_type

(string) (Optional) Post type to get the templates for. If a post is provided, its post type is used.

Default value: 'page'

ReturnReturn

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

SourceSource

File: wp-includes/class-wp-theme.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Added the $post_type parameter.
3.4.0 Introduced.
Scroll to Top