Title: Head Trimmer
Author: John Dalesandro
Published: <strong>2022 年 5 月 26 日</strong>
Last modified: 2026 年 6 月 6 日

---

搜索插件

![](https://ps.w.org/head-trimmer/assets/banner-772x250.png?rev=3562486)

![](https://ps.w.org/head-trimmer/assets/icon-256x256.png?rev=3562486)

# Head Trimmer

 作者：[John Dalesandro](https://profiles.wordpress.org/dalesandro/)

[下载](https://downloads.wordpress.org/plugin/head-trimmer.1.0.5.zip)

 * [详情](https://cn.wordpress.org/plugins/head-trimmer/#description)
 * [评价](https://cn.wordpress.org/plugins/head-trimmer/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/head-trimmer/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/head-trimmer/#developers)

 [支持](https://wordpress.org/support/plugin/head-trimmer/)

## 描述

**Head Trimmer** gives you granular control over what WordPress automatically outputs
in the HEAD element of every page. Each option is independent; enable only the removals
that make sense for your site.

Removing unnecessary HEAD elements reduces page weight, eliminates potential security
signatures such as the WordPress version number, and keeps your generated source
code clean.

All settings are opt-in. Nothing is removed until you enable it on the Admin  Settings
Head Trimmer screen.

Removal options include:

 * WordPress Version (generator meta tag)
 * WordPress Version from Script and Style URLs
 * All Other Version Signatures from Script and Style URLs
 * Shortlink
 * Shortlink from HTTP Response Headers
 * Canonical
 * Relational Links for Posts Adjacent to Current Post
 * RSS Feeds (removes head links and disables feed endpoints)
 * Really Simple Discovery Link for xmlrpc (rsd_link)
 * Windows Live Writer Manifest File Link (wlwmanifest_link)
 * oEmbed Discovery Links
 * REST API Link and REST API Link Header
 * Emoji Support
 * Global Styles and SVG Filters (duotone filters)
 * Gutenberg Block CSS Styles (or optionally set ‘should_load_separate_core_block_assets’
   to load block styles only when needed)
 * Classic Theme CSS Styles (classic-theme-styles)
 * DNS Prefetch for //s.w.org
 * DNS Prefetch for Google Fonts //fonts.googleapis.com
 * jQuery
 * JavaScript Import Map (added in WordPress 6.5)
 * Interactivity API (added in WordPress 6.5)
 * Image Auto Sizes Styles (added in WordPress 6.7)
 * Speculation Rules (added in WordPress 6.8)
 * Comment Reply Script (loads only on singular posts and pages where comments are
   open)

## 屏幕截图

 * [[
 * Head Trimmer admin settings screen.

## 安装

#### Install

 1. Install Head Trimmer through the WordPress.org plugin repository or by uploading
    the .zip file using the Admin  Plugins  Add New function.
 2. Activate Head Trimmer on the Admin  Plugins screen.
 3. Customize settings on the Admin  Settings  Head Trimmer screen.

#### Uninstall

 1. Deactivate the plugin on the Admin  Plugins screen. All plugin files and settings
    will be retained.
 2. Delete the plugin on the Admin  Plugins screen. This deletes both the plugin files
    and all plugin settings stored in the database.

## 常见问题

### The setting to remove a particular element is checked. Why do I still find the element in the source?

Please verify settings for other installed plugins which may re-add an element. 
As an example, various SEO plugins may include an option to add the canonical or
relational links.

### I set the option to remove the WordPress version number from scripts and styles. Why do I still find version numbers in script and style URLs?

Head Trimmer removes the installed WordPress version number from script and style
URLs. It does not remove version numbers generated by other plugins such as caching
and optimization plugins.

### I enabled “Remove Interactivity API”, “Remove JavaScript Import Map”, “Remove Image Auto Sizes Styles”, or “Remove Speculation Rules” and something on my site broke.

These options may break blocks or plugins that rely on the WordPress Interactivity
API, ES module imports, or automatic image sizing. For example, the navigation block
depends on the Interactivity API. If you experience issues, uncheck the relevant
options on the Admin  Settings  Head Trimmer screen.

### Will removing these elements break my site?

Most elements Head Trimmer can remove are informational or legacy features that 
modern sites do not need. However, some options such as Remove jQuery, Remove Interactivity
API, Remove JavaScript Import Map, and Remove Image Auto Sizes Styles can break 
functionality if your theme or plugins depend on them. Speculation Rules is generally
safe to remove as it only affects browser prefetching of internal links. Removing
Canonical can negatively affect SEO on paginated archives. Removing jQuery will 
also prevent any scripts that depend on jQuery from loading. Review the description
next to each setting before enabling it, and test after making changes.

### Does Head Trimmer affect the WordPress admin?

Options that could interfere with admin functionality are automatically limited 
to the front end only. These include removing emoji support, block styles, classic
theme styles, jQuery, and the Interactivity API. The settings screen notes which
options do not affect administrative screens.

### I enabled “Remove Canonical” and I am concerned about SEO.

WordPress outputs canonical links on paginated archives such as page 2 and page 
3 of post listings. Removing canonical links from these pages can result in duplicate
content issues in search engines. If your site uses pagination and SEO is a concern,
consider leaving this option unchecked or using an SEO plugin that manages canonical
links independently.

### I enabled “Remove jQuery” and scripts on my site stopped working.

Removing jQuery also prevents any scripts that declare jQuery as a dependency from
loading. This includes many theme and plugin scripts such as sliders, lightboxes,
and form handlers. If you experience broken functionality after enabling this option,
uncheck it on the Admin  Settings  Head Trimmer screen.

### I enabled “Remove REST API Links” but the REST API is still accessible.

This option only removes the REST API discovery links from the page source and HTTP
response headers. It does not disable the REST API itself. If you need to restrict
REST API access, that requires a separate approach outside the scope of this plugin.

### I enabled “Remove Image Auto Sizes Styles” and my images look smaller than expected.

The image auto sizes CSS fix exists to correct a rendering issue in some browsers
where images using sizes=auto appear smaller than their container. Removing it may
cause this visual issue to reappear. If you notice images displaying incorrectly
after enabling this option, uncheck it on the Admin  Settings  Head Trimmer screen.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Head Trimmer」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ John Dalesandro ](https://profiles.wordpress.org/dalesandro/)

[帮助将「Head Trimmer」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/head-trimmer)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/head-trimmer/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/head-trimmer/)，或通过[RSS](https://plugins.trac.wordpress.org/log/head-trimmer/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/head-trimmer/)。

## 更新日志

#### 1.0.5

 * Adds option to remove JavaScript Import Map
 * Adds option to remove Interactivity API
 * Adds option to remove Image Auto Sizes Styles
 * Adds option to remove Speculation Rules
 * Adds option to load comment reply script only when needed
 * Minor changes to improve code readability

#### 1.0.4

 * Adds option to remove classic themes CSS styles

#### 1.0.3

 * Adds option to set ‘should_load_separate_core_block_assets’ instead of removing
   Gutenberg Block CSS Styles entirely

#### 1.0.2

 * Minor changes to improve code readability and internationalization

#### 1.0.1

 * Minor changes to improve code readability and internationalization

#### 1.0.0

 * Initial Release

## 额外信息

 *  版本 **1.0.5**
 *  最后更新：**2 天前**
 *  活跃安装数量 **20+**
 *  WordPress 版本 ** 5.9 或更高版本 **
 *  已测试的最高版本为 **7.0**
 *  PHP 版本 ** 7.2 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/head-trimmer/)
 * 标签
 * [clean](https://cn.wordpress.org/plugins/tags/clean/)[head](https://cn.wordpress.org/plugins/tags/head/)
   [meta](https://cn.wordpress.org/plugins/tags/meta/)[remove](https://cn.wordpress.org/plugins/tags/remove/)
   [security](https://cn.wordpress.org/plugins/tags/security/)
 *  [高级视图](https://cn.wordpress.org/plugins/head-trimmer/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/head-trimmer/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/head-trimmer/reviews/)

## 贡献者

 *   [ John Dalesandro ](https://profiles.wordpress.org/dalesandro/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/head-trimmer/)