过滤主题的页面模板列表。
原型
apply_filters( "theme_{$post_type}_templates", array $post_templates, WP_Theme $this, WP_Post|null $post, string $post_type )
描述
钩子名称的动态部分$ post_type指的是帖子类型。
参数
$post_templates
(array)
一组页面模板。键是文件名,值是翻译的名称。
$this
(WP_Theme)
主题对象。
$post
(WP_Post|null)
正在编辑的帖子,为上下文提供,或为null。
$post_type
(string)
发布类型以获取模板。
源文件
路径:wp-includes/class-wp-theme.php
其他
英文文档:https://developer.wordpress.org/reference/hooks/theme_post_type_templates/