WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#40098 new enhancement

Prevent same sidebar from outputting twice

Reported by: nathanrice Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: Widgets Keywords:
Focuses: Cc:

Description

I ran across #23934 recently, and it occurred to me that if such a ticket was closed because you're not supposed to call the same sidebar for output twice, why don't we just prevent the same sidebar from outputting twice?

Seems like an easy win, using code to effectively prevent officially discouraged theme behavior.

Anyone have thoughts?

Change History (1)

#1 @westonruter
9 months ago

It's noted on that ticket:

this is not valid to have the same id two or more times

I believe the context here is HTML element IDs. Note that while IDs are _supposed_ to be unique in document, if you have the same ID used more than once it doesn't necessarily break anything, right?

The farthest I'd recommend going with this is to complain with something like _doing_it_wrong() if the same ID is used more than once when calling dynamic_sidebar().

Note: See TracTickets for help on using tickets.