[wp-trac] [WordPress Trac] #54677: Default widgets with alternative option name causing unnecessary database queries
WordPress Trac
noreply at wordpress.org
Tue Dec 21 16:54:20 UTC 2021
#54677: Default widgets with alternative option name causing unnecessary database
queries
--------------------------+-----------------------------
Reporter: Chouby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 5.8
Severity: normal | Keywords:
Focuses: performance |
--------------------------+-----------------------------
This ticket is a follow up to #26876, as the same bug still occurs for the
widget recent comments and the widget recent posts because both have an
alternative option name.
The bug was not detectable at that time because both widgets were used by
default, and thus options were always filled. However, this is no more the
case since the version 5.8. Now if no option have been saved, then we can
see that 4 useless database queries are triggered:
{{{
SELECT option_value
FROM wp_options
WHERE option_name = 'widget_recent-posts'
LIMIT 1
SELECT option_value
FROM wp_options
WHERE option_name = 'widget_recent_entries'
LIMIT 1
SELECT option_value
FROM wp_options
WHERE option_name = 'widget_recent-comments'
LIMIT 1
SELECT option_value
FROM wp_options
WHERE option_name = 'widget_recent_comments'
LIMIT 1
}}}
The bug can easily reproduced on a fresh WP 5.8 install with Query Monitor
to see the useless queries triggered by `WP_Widget->get_settings()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54677>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list