[wp-trac] [WordPress Trac] #48033: Add a register_sidebar_defaults filter

WordPress Trac noreply at wordpress.org
Fri Sep 13 11:04:50 UTC 2019


#48033: Add a register_sidebar_defaults filter
-------------------------+-----------------------------
 Reporter:  powerbuoy    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Widgets      |    Version:  5.2.3
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Being able to change the register_sidebar defaults on a theme basis would
 be excellent for those of us who don't render our widgets in a list.

 Today we have to specify before_widget and after_widget on every call to
 register_sidebar, being able to do this instead would be an improvement:

 {{{#!php
 <?php
 add_filter('register_sidebar_defaults', function ($defaults) {
     $defaults['before_widget'] = '<article id="widget-%1$s"
 class="%2$s">';
     $defaults['after_widget'] = '</article>';

     return $defaults;
 });
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48033>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list