[wp-trac] [WordPress Trac] #10886: WordPress should not unnecessarily query posts at page load
WordPress Trac
noreply at wordpress.org
Thu Sep 10 20:01:52 UTC 2015
#10886: WordPress should not unnecessarily query posts at page load
----------------------------+--------------------------
Reporter: junsuijin | Owner: junsuijin
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4
Component: Bootstrap/Load | Version: 2.8.4
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
----------------------------+--------------------------
Comment (by wonderboymusic):
In [attachment:10886.7.diff 10886.7.diff]:
* `$wp->parse_request()` needs to return a `bool`
* If it returns `false`, send headers, but don't do any querying, 404
handling, or setup of globals
If you use these filters:
{{{
add_filter( 'template_include', '__return_false' );
add_filter( 'do_parse_request', '__return_false' );
}}}
The whole request will only produce 3 db queries (no external cache):
{{{
SELECT option_value FROM wp_options WHERE option_name = 'WPLANG' LIMIT 1
SELECT * FROM wp_users WHERE user_login = 'admin'
SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1)
ORDER BY umeta_id ASC
}}}
`get_option( 'locale' )` gets called even if `WPLANG` is defined in `wp-
config.php` or elsewhere.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/10886#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list