theme_page_templates WordPress Filter Hook

The theme_page_templates hook allows you to add custom page templates to your theme. This hook is called when the page template dropdown is rendered on the page edit screen.

apply_filters( 'theme_page_templates', array $page_templates, WP_Theme $this, WP_Post|null $post ) #

Filters list of page templates for a theme.


Parameters

$page_templates

(array)Array of page templates. Keys are filenames, values are translated names.

$this

(WP_Theme)The theme object.

$post

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


Top ↑

Source

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

View on Trac


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Converted to allow complete control over the $page_templates array.
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.