Use HTML editor in WordPress theme options

2019-09-09 12:00发布

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

1条回答
Summer. ? 凉城
2楼-- · 2019-09-09 12:30

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.

查看更多
登录 后发表回答