apply_filters( "theme_{$post_type}_templates", array $post_templates, WP_Theme $this, WP_Post|null $post, string $post_type )

Filters list of page templates for a theme.


Description

The dynamic portion of the hook name, $post_type, refers to the post type.


Parameters

$post_templates

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

$this

The theme object.

$post

The post being edited, provided for context, or null.

$post_type

Post type to get the templates for.


Source

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

View on GitHub



Changelog

Changelog
Version Description
WP-4.7.0 Added the $post_type parameter.
WP-4.4.0 Converted to allow complete control over the $page_templates array.
WP-3.9.0 Introduced.