WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been handed over a design to translate into WordPress plugin & theme. My question is regarding building a custom comment form.

The design used some custom scripts on the comment submit button. It handles 'submitting...' button state, animations, and checks. And it uses an anchor tag <a> with jQuery's .bind to submit the form.

I noticed that the comment_form function of WordPress did not offer a solution to change the submit button. I only needed to remove it as I'm handling it myself.

What made it worse is that WordPress has hard coded <input name="submit"> into the button, which made it impossible for jQuery to call .submit (more details on this issue here: http://stackoverflow.com/questions/12540953/property-submit-of-object-htmlformelement-is-not-a-function). So just hiding this button with CSS won't work.

If I prefer not to use the <input type="submit"> button of WordPress comment form, do I have any options to build my own button?


share|improve this question
It's a bit older question here, just thought a little update may help you wordpress.stackexchange.com/a/206349/33372 – thednp Oct 23 '15 at 8:40
up vote 2 down vote accepted

This is hard. Output buffering could solve that:

add_action( 'comment_form_field_comment', 'ob_start' );
add_action( 'comment_form', 'wpse_83898_replace_submit' );

function wpse_83898_replace_submit() 
    $html = ob_get_clean();
    # do some magic
    echo $html;

Just an idea, not tested.

share|improve this answer
Hi, thanks for the idea. I ended up hooking 'comment_form_before' and 'comment_form_after' altogether. And I used ob_start("hook_callback"); in 'before', and ob_end_flush() in 'after'. I then have a callback function to do whatever I want with the form. – He Shiming Jan 31 '13 at 11:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.