theme_templates WordPress Filter Hook

The theme_templates hook allows you to modify the templates used by your theme. This can be useful for making small changes to your theme, or for completely customizing your theme.

apply_filters( 'theme_templates', string[] $post_templates, WP_Theme $theme, WP_Post|null $post, string $post_type ) #

Filters list of page templates for a theme.


Parameters

$post_templates

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

$theme

(WP_Theme)The theme object.

$post

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

$post_type

(string)Post type to get the templates for.


Top ↑

Source

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

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.9.6Introduced.

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.