Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I prefer not to use asterisk markers on required fields in the comment form.

So I'd like to remove or alter the 'required fields are marked (*)' message.

Being a good wordpress user, I'd like to do it with my functions.php. I can work out how to filter most areas of the form, but not this. I'm guessing it will involve modifying the 'comment-notes-before' field of the 'defaults' array, but I can't quite see how to do that.

share|improve this question
    
you need to use the comment_form_default_fields to do that. this probably the ugliest function in WP... –  onetrickpony Jun 29 '11 at 10:53
add comment

2 Answers

up vote 2 down vote accepted

What you need to use is comment_form_defaults filter that has large and nested $defaults array passed. That array will have (among other things) something like this in it:

fields
      author << this will have something like <span class="required">*</span> in it
      email << this will have something like <span class="required">*</span> in it
      url 
 comment_notes_before << this will have something like Required fields are marked<span class="required">*</span> in it

So in your filter you need to change these fields in array you got passed and return whole array.

share|improve this answer
add comment

Here is an example of how you can modify the notes before the comment form.

function wpse_comment_notes( $args ) {
    $args['comment_notes_before'] = "All fields are required, though I haven't marked them";
    return $args;
}
add_filter('comment_form_defaults', 'wpse_comment_notes');
share|improve this answer
add comment

Your Answer

 
discard

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.