WordPress.org

Make WordPress Core

Changeset 13205


Ignore:
Timestamp:
02/18/10 23:41:50 (4 years ago)
Author:
nacin
Message:

Bail early for favicon.ico requests so we don't load WP twice. Props azaozz, sivel. Fixes #3426

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/load.php

    r13185 r13205  
    103103    if ( !extension_loaded( 'mysql' ) && !file_exists( WP_CONTENT_DIR . '/db.php' ) ) 
    104104        die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 
     105} 
     106 
     107/** 
     108 * Don't load all of WordPress when handling a favicon.ico request. 
     109 * Instead, send the headers for a zero-length favicon and bail. 
     110 * 
     111 * @since 3.0.0 
     112 */ 
     113function wp_favicon_request() { 
     114        if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) { 
     115                header('Content-Type: image/vnd.microsoft.icon'); 
     116                header('Content-Length: 0'); 
     117                exit; 
     118        } 
    105119} 
    106120 
  • trunk/wp-settings.php

    r13204 r13205  
    4343// Check for the required PHP version and for the MySQL extension or a database drop-in. 
    4444wp_check_php_mysql_versions(); 
     45 
     46// Check if we have recieved a request due to missing favicon.ico  
     47wp_favicon_request(); 
    4548 
    4649// Check if we're in maintenance mode. 
Note: See TracChangeset for help on using the changeset viewer.