I have a theme which uses comments_template() to write a comment form and existing comments to a page. It appears that comments_template() calls comment_form() internally which writes the form that allows the user to submit a comment.

comment_form() takes an array of various settings for the form.

My problem is that I can't pass my array directly to comment_form() because the theme only uses comments_template.

1) Is there a way to pass the array arg through comments_template?

2) Can I override comment_form() in functions.php so that whenever it is called, my args will automatically be passed in. Something like this:

$args = array(
    'first_setting' => 'some value',
    'another_setting' => 'another value'
function my_comment_form($args){
add_action('write_comments_form','my_comment_form') //does an action like 'write_comments_form' exist?

I want my changes to be global, so setting these values here is ok.

1 Answer 1


I was making this too complicated.

The comment_form_default filter can be used to set arguments for comment_form(): https://developer.wordpress.org/reference/hooks/comment_form_defaults/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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