How to Disable FontAwesome and Other Assets in NextGEN Gallery for GDPR and Performance
Content
Many users of the 'Photo Gallery, Sliders, Proofing and Themes – NextGEN Gallery' plugin seek to disable certain assets it loads, primarily for two reasons: GDPR compliance and website performance optimization. A common point of confusion is the plugin's loading of FontAwesome, a large icon library, and other resources like Google Fonts or external scripts. This guide explains the most effective methods to control these assets.
Why Would You Want to Disable These Assets?
- GDPR Compliance: Loading external resources like fonts or scripts from services like Google Fonts or a CDN (e.g., Cloudflare) can potentially transfer a user's IP address to a third party without explicit consent, which conflicts with EU GDPR regulations.
- Performance: The FontAwesome JavaScript file loaded by NextGEN Gallery is quite large (over 1.5 MB in some cases). For users who do not utilize its icons, this represents a significant and unnecessary bandwidth and load time cost.
- Conflicts: In some cases, the version of FontAwesome loaded by NextGEN can conflict with the version loaded by a user's theme or other plugins, causing icons to display incorrectly (e.g., as a question mark '?').
How to Disable FontAwesome in NextGEN Gallery
The simplest and most supported method is to use the built-in option within the plugin.
- Navigate to NextGEN Gallery -> Other Options -> Miscellaneous in your WordPress admin dashboard.
- Find the setting labeled 'Do not enqueue FontAwesome'.
- Set this option to 'Yes'.
- Save your changes.
This will prevent NextGEN from loading its bundled FontAwesome files. If your theme or other plugins rely on FontAwesome, you will need to ensure they are loading their own compatible version. If you notice no visual changes on your site after disabling it, the icons were likely not being used.
Advanced: Disabling All NextGEN Scripts and Styles
If you have custom-built frontend styles and want to prevent NextGEN from loading all of its CSS and JavaScript files, you can use a PHP constant. This is a more advanced solution for users who are confident editing their site's configuration.
Add the following line to your site's wp-config.php file, just before the line that says /* That's all, stop editing! Happy publishing. */.
define('NGG_SKIP_LOAD_SCRIPTS', TRUE);
Important Note: Some users in the sample threads reported that this constant did not work perfectly in all cases. It is recommended to test this thoroughly on a staging site first. This method will disable everything, so it should only be used if you are fully handling the frontend presentation yourself.
What About Google Fonts (Like Lato)?
The 'Photo Gallery, Sliders, Proofing and Themes – NextGEN Gallery' team has stated that recent versions of the free NextGEN Gallery plugin load the Lato font locally from the plugin's files, not from Google's servers. This should make it GDPR-compliant.
However, users have reported that NextGEN Pro or NextGEN Plus may still be loading the Lato font from fonts.googleapis.com. If you are using a premium version and a tool like the Google Fonts Checker detects an external call, you should ensure you are running the latest version of the premium plugin, as updates have specifically addressed font loading. If the issue persists, you would need to contact the support for your premium version.
Why Can't I Use wp_dequeue_script/style Anymore?
Some users found that traditional WordPress functions like wp_dequeue_style() stopped working to remove NextGEN's assets in later versions (around v3.9). The plugin's architecture changed how it enqueues resources. The methods described above (the built-in option and the NGG_SKIP_LOAD_SCRIPTS constant) are the intended ways to handle this and are more reliable than trying to dequeue individual files.
Summary of Solutions
- For FontAwesome: Use the 'Do not enqueue FontAwesome' option in Miscellaneous settings.
- For Everything: Use
define('NGG_SKIP_LOAD_SCRIPTS', TRUE);in yourwp-config.phpfile (use with caution). - For Google Fonts in Pro/Plus: Update to the latest version of your premium plugin.
By using these methods, you can better align your NextGEN Gallery implementation with GDPR requirements and improve your site's loading performance.
Related Support Threads Support
-
disable font awesome linkhttps://wordpress.org/support/topic/disable-font-awesome-link/
-
Missing Lato font file on adminhttps://wordpress.org/support/topic/missing-lato-font-file-on-admin/
-
Google Font Lato Next Gen Galleryhttps://wordpress.org/support/topic/google-font-lato-next-gen-gallery/
-
Cannot dequeue style anymorehttps://wordpress.org/support/topic/cannot-dequeue-style-anymore/
-
How to disable loading the external script “jquery.browser”?https://wordpress.org/support/topic/how-to-disable-loading-the-external-script-jquery-browser/
-
Loading Fontawesome to slow to bighttps://wordpress.org/support/topic/loading-fontawesome-to-slow-to-big/
-
file sizehttps://wordpress.org/support/topic/file-size-18/
-
Disable usage of Google Fonts (DSGVO)https://wordpress.org/support/topic/disable-usage-of-google-fonts-dsgvo/
-
Disable CSS in frontendhttps://wordpress.org/support/topic/disable-css-in-frontend/
-
Fontawesomehttps://wordpress.org/support/topic/fontawesome-21/
-
Need lightweight versionhttps://wordpress.org/support/topic/need-lightweight-version/
-
Tag Cloud Font Sizehttps://wordpress.org/support/topic/tag-cloud-font-size-7/
-
Removing fontawesomehttps://wordpress.org/support/topic/removing-fontawesome/
-
Can’t disable AJAXhttps://wordpress.org/support/topic/cant-disable-ajax-2/
-
Comments in HTMLhttps://wordpress.org/support/topic/comments-in-html/
-
Font Awesome issue after the latest updatehttps://wordpress.org/support/topic/font-awesome-issue-after-the-latest-update/