Opened 7 years ago
Closed 13 months ago
#7696 closed defect (bug) (wontfix)
Widget markup should not have hardcoded `id` param
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | good-first-bug needs-patch |
Cc: |
Description
I've just noticed that at least one of our widget classes has hardcoded id
attributes in the markup generated by widget()
. This shouldn't happen. We should use $this->id
to concatenate id
attributes, in case someone wants to have more than one instance on a page. See eg https://buddypress.trac.wordpress.org/browser/tags/2.9.3/src/bp-groups/classes/class-bp-groups-widget.php?marks=120,130#L118 The rest of our widgets could use an audit for this.
We can minimize backward compatibility breaks by keeping the currently hardcoded IDs for the first instance on a page.
Our JS may also need a review for this - I'm not sure whether it references widget IDs or classes, but it should only use selectors.
Widgets were moved into BP Classic after being deprecated in favor of blocks.