Title: &#8220;Remove Google Fonts&#8221; does not remove preconnect to https://fonts.gstatic.com
Last modified: November 30, 2018

---

# “Remove Google Fonts” does not remove preconnect to https://fonts.gstatic.com

 *  Resolved [mayamitkind](https://wordpress.org/support/users/mayamitkind/)
 * (@mayamitkind)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/)
 * Hi,
    I have disabled Google Fonts using your awesome Autoptimize plugin and indeed,
   I no longer see any fonts loaded from Google servers. Yay!
 * But when I view the source of the webpage, I still see that there will always
   be a request made to fonts.gstatic.com, which performs a DNS lookup and established
   a TCP connection:
 * `<link href='https://fonts.gstatic.com' crossorigin rel='preconnect' />`
 * Not only is this request completely unnecessary when Google Fonts are not needed,
   it also would require me to put a GDPR notice on my website, since the established
   TCP connection leaks the IP address of my visitors to Google (which is what I
   want to prevent in the first place).
 * Is this a bug in the plugin or am I using it wrongly? I am using the Twentyseventeen
   theme (with really minimal modifications, only concerning the CSS).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fremove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/#post-10934773)
 * AO [removes “prefetch” of “fonts.googleapis.com”](https://github.com/futtta/autoptimize/blob/99555ec7d7dd01028d3d3a1dd65ef01cf21f9bbb/classes/autoptimizeExtra.php#L179-L182),
   but you could do something similar for the “preconnect” of “fonts.gstatic.com”
   as well OR you could use the `autoptimize_html_after_minify` filter to str_replace`
   <link href='https://fonts.gstatic.com' crossorigin rel='preconnect' />` to “”?
   🙂
 * frank
 *  Thread Starter [mayamitkind](https://wordpress.org/support/users/mayamitkind/)
 * (@mayamitkind)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/#post-10935821)
 * Thanks, I did the latter!
 *     ```
       /**
        * Removes the preconnect to fonts.gstatic.com
        */
       add_filter('autoptimize_html_after_minify', function($content) {
   
           $content = str_replace("<link href='https://fonts.gstatic.com' crossorigin rel='preconnect' />", ' ', $content);
   
           return $content;
       }, 10, 1);
       ```
   
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/#post-10936350)
 * great job mayamitkind 🙂
 *  [Fropky](https://wordpress.org/support/users/fropki/)
 * (@fropki)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/#post-10936502)
 * Hi,
 * I am not minify html with autooptimize can I remove this line
    <link href=’[https://fonts.gstatic.com&#8217](https://fonts.gstatic.com&#8217);
   crossorigin=’anonymous’ rel=’preconnect’ />
 * from html?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/#post-10936529)
 * yes you can, because `autoptimize_html_after_minify` is called upon as soon as
   one of JS, CSS or HTML optimization is active 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘“Remove Google Fonts” does not remove preconnect to https://fonts.gstatic.
com’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [google fonts](https://wordpress.org/support/topic-tag/google-fonts/)

 * 5 replies
 * 3 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/remove-google-fonts-does-not-remove-preconnect-to-https-fonts-gstatic-com/#post-10936529)
 * Status: resolved