Skip to content

Commit

Permalink
Merge pull request #44 from jeremyfelt/fix/remove-msapplication-TileI…
Browse files Browse the repository at this point in the history
…mage

Don't output msapplication-TileImage tag
  • Loading branch information
jeremyfelt authored Apr 27, 2024
2 parents 3f63140 + e6029f5 commit 86d93b4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mu-plugins/wp/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace JeremyFelt\WP\Head;

add_action( 'plugins_loaded', __NAMESPACE__ . '\remove_default_actions' );
add_filter( 'site_icon_meta_tags', __NAMESPACE__ . '\filter_site_icon_meta_tags' );

/**
* Remove other default actions that output unnecessary elements or do
Expand All @@ -33,3 +34,21 @@ function remove_default_actions(): void {
// Remove embed information on single views.
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
}

/**
* Filter out unnecessary meta tags for the site icon.
*
* @param string[] $meta_tags Array of meta tags.
* @return string[] Modified list of meta tags.
*/
function filter_site_icon_meta_tags( array $meta_tags ): array {

$meta_tags = array_filter(
$meta_tags,
function ( $tag ) {
return ! mb_strpos( $tag, 'msapplication-TileImage' );
}
);

return $meta_tags;
}

0 comments on commit 86d93b4

Please # to comment.