WordPress at Your Fingertips
filter is not described

theme_(post_type)_templates filter-hook . WP 3.9.0

Filters list of page templates for a theme.

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

Possible hook names include:

  • theme_post_templates
  • theme_page_templates
  • theme_attachment_templates


add_filter( 'theme_(post_type)_templates', 'filter_function_name_7973', 10, 4 );
function filter_function_name_7973( $post_templates, $theme, $post, $post_type ){
	// filter...

	return $post_templates;
Array of template header names keyed by the template file name.
The theme object.
The post being edited, provided for context, or null.
Post type to get the templates for.


Since 3.9.0 Introduced.
Since 4.4.0 Converted to allow complete control over the $page_templates array.
Since 4.7.0 Added the $post_type parameter.

Where the hook is called

wp-includes/class-wp-theme.php 1297
$post_templates = (array) apply_filters( "theme_{$post_type}_templates", $post_templates, $this, $post, $post_type );

Where in WP core the hook is used WordPress

Usage not found.