[wp-trac] [WordPress Trac] #46747: Recent Comments widget can add duplicate ID to page

WordPress Trac noreply at wordpress.org
Sun Feb 23 06:38:50 UTC 2020


#46747: Recent Comments widget can add duplicate ID to page
-------------------------------------------------+-------------------------
 Reporter:  mbrailer                             |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  5.4
Component:  Widgets                              |     Version:  5.1
 Severity:  normal                               |  Resolution:
 Keywords:  needs-dev-note has-patch has-        |     Focuses:
  screenshots commit                             |
-------------------------------------------------+-------------------------

Comment (by peterwilsoncc):

 In [attachment:"46747.3.diff"] :

 * replace introduced `$args['widget_id']` with `wp_unique_id(
 'recentcomments-' )`
 * coding standards: snake case the new variable names

 The default arguments for `register_sidebar()` use `id=$args['widget_id']`
 before each widget.

 I did consider `wp-recent-comments-` as the prefix for widget two or later
 but using the existing naming convention will allow for attribute
 selectors in CSS if any sites need to fix styles.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46747#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list