Skip to content

Commit

Permalink
improvements to the favicon optimization regex (hat tip to Simon@Shor…
Browse files Browse the repository at this point in the history
…tpixel)
  • Loading branch information
futtta committed Mar 26, 2024
1 parent 5fbc793 commit 238b780
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/autoptimizeImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ public function filter_optimize_images( $in, $testing = false )
// act on icon links.
if ( ( strpos( $out, '<link rel="icon"' ) !== false || ( strpos( $out, "<link rel='icon'" ) !== false ) ) && apply_filters( 'autoptimize_filter_imgopt_linkicon', true ) ) {
$out = preg_replace_callback(
'/<link\srel=(?:"|\')(?:apple-touch-)?icon(?:"|\').*\shref=(?:"|\')(.*)(?:"|\')(?:\ssizes=(?:"|\')(\d*x\d*)(?:"|\'))?\s\/>/Um',
'/<link\srel=(?:"|\')(?:apple-touch-)?icon(?:-precomposed)?(?:"|\').*\shref=(?:"|\')(.*)(?:"|\')(?:\ssizes=(?:"|\')(\d*x\d*)(?:"|\'))?\s?\/?>/Um',
array( $this, 'replace_icon_callback' ),
$out
);
Expand Down

0 comments on commit 238b780

Please sign in to comment.