I am adding Favicons and Icons to my site manually in a more proper way than what WordPress adds by default. My WordPress is generating the below 4 lines of code automatically.

<link rel="icon" href="http://example.com/wp-content/uploads/sites/3/2015/09/cropped-group_logo-32x32.png" sizes="32x32">
<link rel="icon" href="http://example.com/wp-content/uploads/sites/3/2015/09/cropped-group_logo-192x192.png" sizes="192x192">
<link rel="apple-touch-icon-precomposed" href="http://example.com/wp-content/uploads/sites/3/2015/09/cropped-group_logo-180x180.png">
<meta name="msapplication-TileImage" content="http://example.com/wp-content/uploads/sites/3/2015/09/cropped-group_logo-270x270.png">

I tried a lot but could not figure out how to stop WordPress from generating this.

Kindly help

Update: After using the function provided by @Gareth, I am getting the following error:

Warning: array_filter() expects parameter 1 to be array, null given in C:\xampp\htdocs\example\wp-includes\general-template.php on line 2466

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\example\wp-includes\general-template.php on line 2468
  • not much help code wise but make.wordpress.org/core/2015/07/27/site-icon explains how the icons are added and what functions are used so will give you a starting point to find a filter to remove them Oct 17, 2015 at 14:27
  • Filter 'site_icon_meta_tags' is given an array of meta tags including these...
    – bonger
    Oct 17, 2015 at 14:39

3 Answers 3


Finally I found the answer outside of this place, hence I am posting it here as it may be useful to someone like me.

Simply add this to your functions.php file

remove_action ('wp_head', 'wp_site_icon', 99);
  • After using remove_action ('wp_head', 'wp_site_icon', 99); you can add your own favicon function by adding something like add_action('wp_head', 'my_site_icon_function', 99);
    – imelgrat
    Jun 12, 2018 at 21:43

I was able to use the following in my functions.php to remove the apple-touch-icon:

// Don't use the Site Icon as Apple Touch Icon (instead, use those for favicon & others while the touch icon is provided elsewhere)
function removeAppleTouchIconFilter($string) {
  return strpos($string, 'apple-touch-icon') === false;
function prevent_apple_touch_icon_metatag($meta_tags){
    return array_filter($meta_tags, 'removeAppleTouchIconFilter');

This way, it finds the icon within the array of meta tags rather than using a hard-set index value. This should prevent issues if the position of this item in the array ever changes.


from looking at line 2446 of general-template.php where the meta tags are defined, they are defined in an array of $meta_tags, the only way I could think of to remove the 2 options you want is:

function theme_metatags($meta_tags) {
 array_splice($meta_tags, 2);
add_filter('site_icon_meta_tags', 'theme_metatags');

That should remove the last 2 icons from the array which is the 2 lines in your post.

I haven't tested this and it's probably not the ideal solution (hopefully someone else will be able to work out a better way).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.