Bail early for favicon.ico requests so we don't load WP twice. Props azaozz, sivel. Fixes #3426
git-svn-id: https://develop.svn.wordpress.org/trunk@13205 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ea0b2aacf0
commit
5921acfa63
@ -104,6 +104,20 @@ function wp_check_php_mysql_versions() {
|
||||
die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't load all of WordPress when handling a favicon.ico request.
|
||||
* Instead, send the headers for a zero-length favicon and bail.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function wp_favicon_request() {
|
||||
if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
|
||||
header('Content-Type: image/vnd.microsoft.icon');
|
||||
header('Content-Length: 0');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dies with a maintenance message when conditions are met.
|
||||
*
|
||||
|
@ -43,6 +43,9 @@ wp_fix_server_vars();
|
||||
// Check for the required PHP version and for the MySQL extension or a database drop-in.
|
||||
wp_check_php_mysql_versions();
|
||||
|
||||
// Check if we have recieved a request due to missing favicon.ico
|
||||
wp_favicon_request();
|
||||
|
||||
// Check if we're in maintenance mode.
|
||||
wp_maintenance();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user