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

WordPress Trac noreply at wordpress.org
Mon Jul 27 17:23:31 UTC 2020


#44098: Widget classes when custom widget class is namespaced
--------------------------+------------------------------
 Reporter:  rogerlos      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Widgets       |     Version:  5.4.2
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------
Changes (by Mte90):

 * keywords:  reporter-feedback => needs-patch
 * version:   => 5.4.2


Comment:

 I can confirm the issue.
 This happens when you don't define the id_base that is automatically
 generated.

 {{{#!php
 <?php
 // https://developer.wordpress.org/reference/classes/wp_widget/
 // line 163
  $this->id_base         = empty( $id_base ) ? preg_replace(
 '/(wp_)?widget_/', '', strtolower( get_class( $this ) ) ) : strtolower(
 $id_base );
 }}}

 So it use the class to generate it but if it is a namespace generated
 `namespace\sub\sub\class` doesn't do anything creating this issues.

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


More information about the wp-trac mailing list