[wp-trac] [WordPress Trac] #20302: Allow comment_form() to add attributes to <form> tag

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 25 15:48:54 UTC 2012


#20302: Allow comment_form() to add attributes to <form> tag
-------------------------+-----------------------------
 Reporter:  psbook       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Comments     |    Version:
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 The standard method to allow Google Analytics to track comment submissions
 as a 'goal' is to add a piece of JavaScript code wrapped in an 'onsumbit'
 attribute:
 http://www.optimisationbeacon.com/analytics/track-blog-comments-in-google-
 analytics/
 http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html

 We want something like the following:

 {{{
 <form action="http://www.example.com/wp-comments-post.php" method="post"
 id="commentform" onsubmit="_gaq.push(['_trackEvent', 'Comments', 'Submit',
 'POST TITLE']);">
 }}}

 However the current arguments submitted to comment_form() do not provide
 for adding attributes to <form>
 http://codex.wordpress.org/Function_Reference/comment_form

 I was forced to perform a workaround in which the onsubmit code was
 inserted by JavaScript on the fly at runtime.

 So this is request to alter comment_form() such that arguments accepted
 provide for 'onsubmit' or other custom attributes to be appended on the
 <form> tag.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20302>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list