Support » Fixing WordPress » Comment editor using wp_editor won't submit

  • I’ve used wp_editor to replace the default comment editor in my WordPress install, and it looks beautiful and functions just as it’s supposed to…when you’re typing. But when I click “Submit,” I get this error:

    “Error: Please type a comment.”

    This is the entire code for that section:

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    	<?php wp_editor( $listing->post_content, 'listingeditor', $settings = array('textarea_name' => post_content, 'textarea_rows' => 8) ); ?>
    	<input type="submit" class="commentsubmit" value="Submit" />
    	<?php comment_id_fields(); ?>
    	<?php do_action('comment_form', $post->ID); ?>
    </form>
Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve used wp_editor to replace the default comment editor in my WordPress install,

    Sorry? You did what?

    Thread Starter 1db

    (@1db)

    In the form, I replaced this:

    <textarea name="comment" id="comment" rows="10" cols="" class="textbox"></textarea>

    …with this:

    <?php wp_editor( $listing->post_content, 'listingeditor', $settings = array('textarea_name' => post_content, 'textarea_rows' => 8) ); ?>

    That displays the TinyMCE editor, and it works while typing but it won’t submit.

    Remove that change and try looking a suitable comment editor plugin instead.

    I’ve found this snippet

    add_filter( 'comment_form_defaults', 'custom_comment_form_defaults' );
    function custom_comment_form_defaults( $args ) {
        if ( is_user_logged_in() ) {
            $mce_plugins = 'inlinepopups, fullscreen, wordpress, wplink, wpdialogs';
        } else {
            $mce_plugins = 'fullscreen, wordpress';
        }
        ob_start();
        wp_editor( '', 'comment', array(
            'media_buttons' => true,
            'teeny' => true,
            'textarea_rows' => '7',
            'tinymce' => array( 'plugins' => $mce_plugins )
        ) );
        $args['comment_field'] = ob_get_clean();
        return $args;
    }

    It works like a charm!

    Source: http://www.revood.com/blog/adding-visual-editor-to-wordpress-comments-box-part-2/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Comment editor using wp_editor won't submit’ is closed to new replies.