Adding favicon to admin panel from your theme

In order to add your favicon from theme to your wordpress admin panel we can use this simple code snippet. Basically this code insert <link> tag into <head> of admin area using admin_head action.

function my_favicon() {
	$path = get_template_directory_uri() . '/assets/fav/favicon.ico';

	echo '<link rel="shortcut icon" href="' . esc_url($path) . '" />';
}

add_action( 'admin_head', 'my_favicon' );