[wp-trac] [WordPress Trac] #44098: Widget classes when custom widget class is namespaced

WordPress Trac noreply at wordpress.org
Sun May 23 09:45:15 UTC 2021


#44098: Widget classes when custom widget class is namespaced
-------------------------------------------------+-------------------------
 Reporter:  rogerlos                             |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.8
Component:  Widgets                              |     Version:  5.4.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-dev-   |     Focuses:
  note                                           |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [comment:15 SergeyBiryukov]:
 > That might still cause some previously saved namespaced widgets to
 disappear or lose their settings due to the option name change, but let's
 try this during the beta phase and see if we have any reports of that.
 >
 > If we do get any reports, we might want to consider only doing this for
 the `classname` value and not for `id_base`.

 On second thought, if the only concerns here are the class name and the
 PHP warning, it seems like a safer approach to just address that, instead
 of changing `id_base`. Since the handbook has an
 [https://developer.wordpress.org/themes/functionality/widgets/#example-
 with-a-namespace example with a namespace], it might be too common a
 pattern in the wild to cause any unnecessary breakage.

 Let's also switch to underscores to avoid a mix of underscores and
 hyphens. See [attachment:"44098.diff"].

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


More information about the wp-trac mailing list