[wp-trac] [WordPress Trac] #55595: Consider only registering widgets on themes that supports widgets

WordPress Trac noreply at wordpress.org
Wed Apr 20 17:42:33 UTC 2022


#55595: Consider only registering widgets on themes that supports widgets
--------------------------+-----------------------------
 Reporter:  spacedmonkey  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:  performance   |
--------------------------+-----------------------------
 The `wp_widgets_init` function is run all init and is run on every
 request. This is wasteful for a number of reasons. Register a widget can
 result in a get_option lookup. Also, if the theme does not support
 widgets, then this is wasteful. Consider adding a simple check at the
 start of `wp_widgets_init` to check if the current theme supports widgets,
 before registering.

 This is specially good, considering that more and more themes are now
 block based and do not use widgets at all.

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


More information about the wp-trac mailing list