Remove Google Scripts from WordPress
How do I remove unwanted Google scripts from WordPress in GNU/Linux…
…or any other fonts and APIs?
This is Collateral Damage.
With the recent spy scandal revealed by Edward Snowden implicating major corporations in a range of sweeping data collection efforts, it is no wonder why many would prefer to opt out of Google’s data mining operations. In this post, we tackle how to remove Google Scripts from WordPress in GNU/Linux, so you can begin your project in a clean fashion, especially if you are in a country where Google servers are blocked.
Moving scripts externally is actually a good thing for WordPress. It helps preserve the autonomy of WordPress as an independent open source CMS. It also improves the modular functionality of WordPress in case these scripts become deprecated, obsolete, move to different locations, or get replaced. However, it would be helpful if the WordPress setup files have an advanced option for users to choose their own locations for external resources instead of forcing users to go to places such as these big corporations, many of which are blocked in several countries around the world.
Rather than meticulously search every file in the FTP server or on some file system, which would be very time consuming, I download a fresh copy of WordPress and search for ¨googleapis¨ using a GNU/Linux utility called grep.
The way that I remove unwanted google scripts from WordPress in GNU/Linux at the Terminal is:
home@home-desktop$grep -r "googleapis" wp-content/
In the command above, the -r indicates that it is to execute recursively, the second argument is the string that I’m searching for and the third argument is the root where to begin searching. The next step is to analyze the output of the above command.
Within the entries of that output can be found references to Google fonts inside the wp-includes/script-loader.php located in LOC: 708.
P.S.: Here is an alternative to Google fonts that I know of: Fonts.useso.com, but you should use extreme caution when referencing any external servers in order to load your fonts in WordPress core, plugins, or themes.