wp_theme_editor_filetypes
云策文档标注
概述
wp_theme_editor_filetypes 是一个 WordPress 过滤器,用于控制主题文件编辑器中允许编辑的文件类型列表。它允许开发者自定义可编辑的文件扩展名数组。
关键要点
- 这是一个过滤器 Hook,用于修改主题文件编辑器中的可编辑文件类型。
- 接收两个参数:$default_types(默认文件扩展名数组)和 $theme(活动主题对象)。
- 在 WordPress 4.4.0 版本中引入。
- 与 wp_get_theme_file_editable_extensions() 函数相关,用于获取主题的可编辑文件扩展名。
- 注意:插件文件编辑器使用不同的 Hook(editable_extensions)来过滤文件扩展名。
代码示例
$file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );
原文内容
Filters the list of file types allowed for editing in the theme file editor.
Parameters
$default_typesstring[]-
An array of editable theme file extensions.
$themeWP_Theme-
The active theme object.
Source
$file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
Skip to note 2 content
Martijn van der Klis
On the plugin file editor, use the editable_extensions hook to filter the file extensions.