Use HTML editor in WordPress theme options

2019-09-09 11:46发布

问题:

I have a <textarea> in my wp theme settings. How can I convert this to use the wordpress HTML editor instead?

回答1:

Use wp_editor().

Example:

$editor_settings =  array (
    'textarea_rows' => 8
,   'media_buttons' => FALSE
,   'teeny'         => TRUE
,   'tinymce'       => FALSE
    // a very minimal setup
,   'quicktags'     => array ( 'buttons' => 'strong,em,link' )
);
wp_editor( $content, $key, $editor_settings );

For a better example see this answer and the tag wp-editor on WordPress Stack Exchange.