[wp-trac] [WordPress Trac] #19709: Add 'before_sidebar' and 'after_sidebar' attributes to register_sidebar()

WordPress Trac noreply at wordpress.org
Mon Nov 16 22:14:31 UTC 2020


#19709: Add 'before_sidebar' and 'after_sidebar' attributes to register_sidebar()
--------------------------------------+-----------------------
 Reporter:  dgwyer                    |       Owner:  audrasjb
     Type:  task (blessed)            |      Status:  reopened
 Priority:  high                      |   Milestone:  5.6
Component:  Widgets                   |     Version:  2.2
 Severity:  normal                    |  Resolution:
 Keywords:  has-unit-tests has-patch  |     Focuses:
--------------------------------------+-----------------------

Comment (by helen):

 Replying to [comment:28 audrasjb]:
 > Yes, it's up to developers to use a different ID for each sidebar, but I
 think it's pretty logicial to give each sidebar a different ID.

 What I mean is that unless I'm reading wrong the ID passed as `$1$s` into
 `before_widget` is the same as `before_sidebar`, so if you just set
 `before_sidebar` using that argument without altering the `before_widget`
 default you will end up with two elements with the same ID, which isn't
 valid. I don't really like the idea of providing developers with an API
 that can easily create a bad state. I don't know if there needs to be more
 documentation or some kind of detection in core that then adds a prefix or
 something but I don't really want to leave this as-is.

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


More information about the wp-trac mailing list