wp_code_editor_settings
Filters settings that are passed into the code editor.
Returning a falsey value will disable the syntax-highlighting code editor.
Usage
add_filter( 'wp_code_editor_settings', 'wp_kama_code_editor_settings_filter', 10, 2 );
/**
* Function for `wp_code_editor_settings` filter-hook.
*
* @param array $settings The array of settings passed to the code editor. A falsey value disables the editor.
* @param array $args Args passed when calling `get_code_editor_settings()`.
*
* @return array
*/
function wp_kama_code_editor_settings_filter( $settings, $args ){
// filter...
return $settings;
}
- $settings(array)
- The array of settings passed to the code editor. A falsey value disables the editor.
- $args(array)
Args passed when calling
get_code_editor_settings().-
type(string)
The MIME type of the file to be edited. -
file(string)
Filename being edited. -
theme(WP_Theme)
Theme being edited when on the theme file editor. -
plugin(string)
Plugin being edited when on the plugin file editor. -
codemirror(array)
Additional CodeMirror setting overrides. -
csslint(array)
CSSLint rule overrides. -
jshint(array)
JSHint rule overrides. - htmlhint(array)
HTMLHint rule overrides.
-
Changelog
| Since 4.9.0 | Introduced. |
Where the hook is called
wp_code_editor_settings
wp-includes/general-template.php 4478
return apply_filters( 'wp_code_editor_settings', $settings, $args );