开发者

How to enable tinyMCE rich text editor for post Comments in WordPress?

开发者 https://www.devze.com 2023-01-26 10:59 出处:网络
I would love to kinda replicate WordPress post/page text editor (Admin panel) in comments section. That\'s how site users will be able to format text easily. A good example of what I actually need can

I would love to kinda replicate WordPress post/page text editor (Admin panel) in comments section. That's how site users will be able to format text easily. A good example of what I actually need can be found here开发者_开发技巧 at StackOverflow when someone is about to Ask Question.


In your functions.php, add the following snippet:

add_filter( 'comment_form_defaults', 'tinymce_comment_4265340' );
function tinymce_comment_4265340 ( $args ) {
    ob_start();
    wp_editor( '', 'comment', array('tinymce') );
    $args['comment_field'] = ob_get_clean();
    return $args;
}

It's working on WordPress 3.5 and Twenty Twelve theme.


The TinyMCEComment WordPress plugin could help you out. It uses the internal TinyMCE editor (bundled in WordPress 2.0 and up).


Try this tutorial. It worked for me. The above answer might add TinyMCE to the reply section. The tutorial shows how to fix that.

0

精彩评论

暂无评论...
验证码 换一张
取 消