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()
Source code
* * @param string[] $post_templates Array of template header names keyed by the template file name. * @param WP_Theme $theme The theme object. * @param WP_Post|null $post The post being edited, provided for context, or null. * @param string $post_type Post type to get the templates for. */ $post_templates = (array) apply_filters( 'theme_templates', $post_templates, $this, $post, $post_type ); /** * Filters list of page templates for a theme. * * The dynamic portion of the hook name, `$post_type`, refers to the post type. *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.