How can I set the validation rules for the comment field?
I change the value of commenter name/e-mail/homepage onmouseover and onblur (I use this instead of labels – so if the field is empty it displays “Your e-mail”, “Your homepage”, etc.). The problem is, on submit, it submits this text in the homepage field (since it has no validation unlike the e-mail field where you get an error if you entered anything except something@something.something).
How could I validate the homepage field?
Comments processing is done in the file: wp-comments-post.php. You can use the hook
pre_comment_on_post
to validate the values entered in the comment form fields.if you want to change a submitted value, use the filter
preprocess_comment
. E.g.: