Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 913
user518505 Avatar asked Nov 24 '10 09:11

user518505


1 Answers

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.

like image 68
Ahmad Suhendri Avatar answered Sep 27 '22 22:09

Ahmad Suhendri