i have a strange problem with altering comment text field in single post.
I’ve created $fields = array(). Inside this array, beisdes other fields, i’ve also added ‘comment_field’ => ‘<p class=”comment-form-comment”><label for=”comment”>’ . _x( ‘New Label’, ‘noun’ ) . ‘</label><br /><textarea id=”comment” name=”comment” aria-required=”true”></textarea></p>’, based on WordPress documentation.
I expected from WP to overwrite current Comment field, but instead it just displayed the one i added in code and kept the old one.
Does anybody have any idea why the system doesn’t overwrite the old field with the new one?
Thanks
]]>The textarea is treated separately from other fields. If you added your textarea with the rest of the fields, WP treats it as an extra custom field and still outputs its own textarea. Supply your textarea as a separate “comment_field” argument and it’ll be used in place of the default.
comment_form( array(
'fields'=> $fields,
'comment_field'=>'<p class="comment-form-comment"><label for="comment">' . _x( 'New Label', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
));
]]>
thank you very much for this hint. I didn’t know that comment_field is treated completely separate from other fields. That’s quite strange.
Anyway, thanks again.
Best regards
]]>