<?php

function askapache_separate_favicons() {
    
    
// default for frontend
    
$favicon_uri = WP_SITEURL . '/favicon.ico';
    
    
// if in backend change to the admin-favicon.ico file located in the active theme directory where style.css is
    
if ( is_admin() ) $favicon_uri = preg_replace( '|https?://[^/]+|i', '', get_stylesheet_directory_uri() ) . '/admin-favicon.ico';

    
// output the xhtml
    
echo '<link rel="shortcut icon" href="' . $favicon_uri . '" type="image/x-icon" />';
    
}
add_action( 'wp_head', 'askapache_separate_favicons' );
add_action( 'admin_head', 'askapache_separate_favicons' );

?>