[wp-trac] [WordPress Trac] #51546: the_widget template tag does not support all widgets

WordPress Trac noreply at wordpress.org
Fri Oct 16 02:11:42 UTC 2020


#51546: the_widget template tag does not support all widgets
--------------------------+-----------------------------
 Reporter:  manfcarlo     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Any widgets that are registered by instance rather than class name (see
 #28216) can not be accessed through
 [https://developer.wordpress.org/reference/functions/the_widget/
 the_widget] because it requires a class name.

 For widgets registered by instance, the
 [https://www.php.net/manual/en/function.spl-object-hash.php
 spl_object_hash] is stored in place of the class name in
 `$GLOBALS['wp_widget_factory']->widgets`.

 Technically, it would work if the correct hash were provided, but since
 the hash changes on every session, this is practically impossible.

 Since all widgets have a unique id base, would it be viable for
 `the_widget` to accept an id base instead of a class name?

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


More information about the wp-trac mailing list