Note: This field is for the Classic WordPress editor based on the TinyMCE code. This is not for the newer Block WordPress editor (Gutenberg).
Arguments
Name | Type | Default | Description |
---|---|---|---|
id | string | A unique ID. This ID will be used to get the value | |
type | string | wp_editor | Type of the field |
title | string | Title of the field | |
default | string | Default value from database, if the option doesn’t exist | |
subtitle | string | Subtitle to display below the title | |
desc | string | Description to display after the field | |
help | string | Text to display on right-corner (as hover/popup) the field | |
class | string | Extra CSS classes (space separated) to append to the field | |
before | string | Content to display before the field | |
after | string | Content to display after the field | |
dependency | array | Define field visibility depending on other field value | |
attributes | array | Extra HTML attributes to append to the field | |
sanitize | string | Callback function for sanitizing value | |
validate | string | Callback function for validating value | |
EXTRAS | |||
tinymce | bool | true | Flag to load TinyMCE |
quicktags | bool | true | Flag to load Quicktags |
media_buttons | bool | true | Flag to display media insert/upload buttons |
height | string | 250px | The height of the editor area. |
Simple WP Editor Field Example
array(
'id' => 'example-wp-editor',
'type' => 'wp_editor',
'title' => 'WordPress Editor',
),
WP Editor Field Example with Custom Settings
array(
'id' => 'example-wp-editor',
'type' => 'wp_editor',
'title' => 'WordPress Editor',
'tinymce' => true,
'quicktags' => true,
'media-buttons' => true,
'height' => '100px',
),