apply_filters( 'theme_templates', string[] $post_templates, WP_Theme $theme, WP_Post|null $post, string $post_type )
- Since
- 4.9.6
Filters list of page templates for a theme.
Compatibility
- WordPress
- since 4.9.6
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$post_templatesstring[]- Array of template header names keyed by the template file name.
$themeWP_Theme- The theme object.
$postWP_Post|null- The post being edited, provided for context, or null.
$post_typestring- Post type to get the templates for.
Where this hook fires · 1
wp-includes/class-wp-theme.php:1429WP_Theme::get_page_templates()
Changelog
Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.