[wp-hackers] Weird behaviour with comment_author_url and input placeholders

Lynne Pope lynne.pope at gmail.com
Thu Jan 27 13:05:28 UTC 2011


I've been working on two sites, one on WP 2.9.2 and another running 3.0.4.
Both require their comment forms to be written in HTML5 using the
placeholder tag.

eg.
 <label for="url">Website</label>
<input type="url" name="url" id="url" value="<?php echo
esc_attr($comment_author_url); ?>" placeholder="Enter Website Address
(optional)" pattern="https?://.+">

In testing, we have identified a problem with comment_author_url that occurs
when people do not input an URL. For some reason, WordPress is picking up
the placeholder text and saving it into the database, like so:
http://EnterWebsiteAddress(optional)

I'm having real trouble trying to identify why this is happening. The
placeholder attribute isn't inside the input value so should not be getting
picked up.

Is this a bug? I realise HTML5 placeholder attributes are still reasonably
new but it's not hard to have this working across current browsers so I
suspect others will hit the same issue.

Cheers,
Lynne


More information about the wp-hackers mailing list