[wp-trac] [WordPress Trac] #23909: Widgets Settings Loaded When No-Needed
WordPress Trac
noreply at wordpress.org
Tue Aug 5 20:49:58 UTC 2014
#23909: Widgets Settings Loaded When No-Needed
--------------------------+------------------------------
Reporter: alex-ye | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 3.5.1
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+------------------------------
Comment (by ryanduff):
Did some more digging. Not tied to inactive widgets, but rather
unregistered widgets. Core adds a few widgets to the sidebar on install
which gets them an entry in the DB. _register_widgets() then excludes them
from the _register() call which is what is triggering the get_option() as
noted in the backtrace (image in [comment:3 ryanduff]).
So... on a clean install if no widgets were added to a sidebar, you'd
actually be adding about 12 db queries, not including whatever the current
theme is registering.
This looks to be any widget that has never been added to a sidebar, so the
number of queries will vary from site to site.
I'm still trying to grok the WP_Widget class internals, but it looks like
it may only need to do this if the widget is actually registered in a
sidebar and not global, at least on the front end. If you're in admin or
customizer, it still needs to instantiate the widget from the looks of
things.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/23909#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list