editable_extensions
云策文档标注
概述
editable_extensions 过滤器用于修改插件文件编辑器中允许编辑的文件类型列表。它接受一个文件扩展名数组和插件路径作为参数,允许开发者自定义可编辑的文件类型。
关键要点
- 过滤器名称:editable_extensions
- 参数:$default_types(默认文件扩展名数组)和 $plugin(插件文件路径)
- 用途:控制插件文件编辑器中的可编辑文件类型
- 相关函数:wp_get_plugin_file_editable_extensions()
- 变更历史:在 WordPress 4.9.0 版本中添加了 $plugin 参数,最初在 2.8.0 版本引入
注意事项
对于主题文件编辑器,应使用 wp_theme_editor_filetypes 钩子来过滤文件扩展名。
原文内容
Filters the list of file types allowed for editing in the plugin file editor.
Parameters
$default_typesstring[]-
An array of editable plugin file extensions.
$pluginstring-
Path to the plugin file relative to the plugins directory.
Source
$file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin );
Skip to note 2 content
Martijn van der Klis
On the theme file editor, use the wp_theme_editor_filetypes hook to filter the file extensions.