Head Trimmer Plugin for WordPress
The Head Trimmer plugin for WordPress is a customizable tool designed to remove automatically generated information from the HEAD
element across a site. Many WordPress sites include extraneous meta tags, links, and other elements in the HEAD
section by default. While some of these elements may serve a specific purpose, they can also contribute unnecessary bloat, slow down page load times, and expose sensitive information such as WordPress version details, which could be used by attackers to exploit vulnerabilities.
Cleaning up the HEAD
element is essential for improving both the performance and security of a WordPress site. By removing unnecessary or potentially sensitive data, you can streamline the source code, making it cleaner and more secure.
Typical Bloat in the HEAD
Element
- WordPress Version Information: WordPress automatically includes its version number in the HTML, which can provide attackers with a target for exploits if vulnerabilities in that version are discovered.
- Shortlinks: WordPress generates a shortlink to the current post, which is often unnecessary and can clutter the
HEAD
. - Canonical Links: While canonical URLs help prevent duplicate content issues, they are not always needed in every page or post.
- oEmbed Discovery Links: WordPress includes links for embedding content from other sites. If you’re not using these features, they add unnecessary overhead.
- Emoji Support: WordPress includes a script for emoji support by default, which may not be necessary for many sites.
- DNS Prefetching: DNS prefetch links to external services like
//s.w.org
or Google Fonts are often not required and can slow down page load times by making unnecessary external requests. - jQuery: WordPress automatically loads jQuery on every page, even if it’s not used. This can add to the page load time and potentially conflict with other libraries.
By removing these elements, the Head Trimmer plugin reduces bloat, enhances performance, and helps prevent exposure of unnecessary details in the HTML source code.
Removal Options
- WordPress Version
- WordPress Version from URLs for Scripts and Styles
- Shortlink
- Shortlink from HTTP response headers
- Canonical
- Relational Links for Posts Adjacent to Current Post
- RSS Feeds
- Really Simple Discovery Link for xmlrpc (
rsd_link
) - Windows Live Writer Manifest File Link (
wlwmanifest_link
) - oEmbed Discovery Links
- REST API Link
- REST API Link Header
- Emoji Support
- Global Styles and SVG Filters (duotone filters)
- Gutenberg Block CSS Styles (or set
should_load_separate_core_block_assets
) - Classic Theme Styles (
classic-theme-styles
) - DNS Prefetch for
//s.w.org
- DNS Prefetch for Google Fonts
//fonts.googleapis.com
- jQuery