apply_filters( 'theme_page_templates', array $page_templates , WP_Theme $this , WP_Post|null $post )
Filters list of page templates for a theme.
Parameters
Source
File: wp-includes/class-wp-theme.php
.
View all references
Changelog
Version | Description |
---|---|
4.4.0 | Converted to allow complete control over the $page_templates array. |
3.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
If you want to remove templates from both Pages and Posts, you will need to also use the `theme_post_templates` in addition to the `theme_page_templates` filter.
Filter page templates by blog id
Suppose you have the blog `Food` with the id 2 and the template `page-food.php` which should only be used for this blog. The example below removes the page template from dropdowns of other blogs:
To filter the “Default template” option in the list of Page Templates, see
default_page_template_title
.