WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/18/2010 11:41:50 PM (12 years ago)
Author:
nacin
Message:

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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.