What’s the proper way to add a favicon in WordPress without a plugin? [closed]

I usually put the icons in an images folder inside my theme so I’d use

function kia_add_favicon(){ ?>
    <!-- Custom Favicons -->
    <link rel="shortcut icon" href="https://wordpress.stackexchange.com/questions/43928/<?php echo get_stylesheet_directory_uri();?>/images/favicon.ico"/>
    <link rel="apple-touch-icon" href="<?php echo get_stylesheet_directory_uri(); ?>/apple-touch-icon.png">
    <?php }
add_action('wp_head','kia_add_favicon');

edited: to add the apple touch icon per the comment, and to clarify that if you are using a child theme, but the favicon is in the parent theme’s image folder, you’d use

get_template_directory_url();

if you are not using a child theme, then either will work

I usually create my favicons here:
http://tools.dynamicdrive.com/favicon/

Leave a Comment