WordPress.org

Ready to get started?Download WordPress

Forums

Comment editor using wp_editor won't submit (5 posts)

  1. 1db
    Member
    Posted 1 year ago #

    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>
  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I've used wp_editor to replace the default comment editor in my WordPress install,

    Sorry? You did what?

  3. 1db
    Member
    Posted 1 year ago #

    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.

  4. esmi
    Forum Moderator
    Posted 1 year ago #

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

  5. webbistro
    Member
    Posted 9 months ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.