wp_code_editor_settings

过滤钩子
apply_filters( 'wp_code_editor_settings', $settings, $args )
参数
  • (array) $settings The array of settings passed to the code editor. A falsey value disables the editor.
    Required:
  • (array) $args { Args passed when calling `get_code_editor_settings()`. @type string $type The MIME type of the file to be edited. @type string $file Filename being edited. @type WP_Theme $theme Theme being edited when on the theme file editor. @type string $plugin Plugin being edited when on the plugin file editor. @type array $codemirror Additional CodeMirror setting overrides. @type array $csslint CSSLint rule overrides. @type array $jshint JSHint rule overrides. @type array $htmlhint HTMLHint rule overrides. }
    Required:
定义位置
相关勾子
wp_editor_settingsblock_editor_settings_allwp_editor_set_qualitywp_theme_editor_filetypeswp_editor_expand
相关方法
wp_get_code_editor_settingswp_user_settingsget_block_editor_settingsget_default_block_editor_settingswp_color_scheme_settingswp_get_global_settings
引入
4.9.0
弃用
-

wp_code_editor_settings 函数是一个 WordPress 核心函数: 这个函数返回包含代码编辑器设置的数组,包括代码编辑器的主题、字体大小、语言等。

过滤传入代码编辑器的设置。

返回一个错误的值将禁用语法高亮的代码编辑器。

return apply_filters( 'wp_code_editor_settings', $settings, $args );

常见问题

FAQs
查看更多 >