Title: WP Anchor Header
Author: Per Søderlind
Published: <strong>2015 年 3 月 2 日</strong>
Last modified: 2026 年 5 月 16 日

---

搜索插件

![](https://ps.w.org/wp-anchor-header/assets/banner-772x250.jpg?rev=3534012)

![](https://ps.w.org/wp-anchor-header/assets/icon-256x256.jpg?rev=3534012)

# WP Anchor Header

 作者：[Per Søderlind](https://profiles.wordpress.org/pers/)

[下载](https://downloads.wordpress.org/plugin/wp-anchor-header.0.3.0.zip)

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

 [支持](https://wordpress.org/support/plugin/wp-anchor-header/)

## 描述

WP Anchor Header generates anchored headings (H1-H6), creating a heading like this:

    ```
    <h2 id="the-heading">
       The Heading<a class="anchorlink dashicons-before" href="#the-heading"></a>
    </h2>
    ```

The links are styled using the following CSS:

    ```
    /* show IDs for anchors */
    h1[id]:hover a.anchorlink:before,
    h2[id]:hover a.anchorlink:before,
    h3[id]:hover a.anchorlink:before,
    h4[id]:hover a.anchorlink:before,
    h5[id]:hover a.anchorlink:before,
    h6[id]:hover a.anchorlink:before {
        content: "\f103"; /*dashicons-admin-links*/
        color: #888;
        font-size: smaller;
        text-decoration: none;
        vertical-align: baseline;
    }
    a.anchorlink {
        text-decoration: none;
        margin-left: 0.5em;
        font-size: smaller;
    }
    ```

### Credits

The plugin is inspired by Christian Weiske and his article [Usability: Clickable heading links](http://cweiske.de/tagebuch/html-heading-links.htm).

## 安装

 1. Download the plugin and extract the read-online.zip
 2. Upload the extracted `read-online` folder to the `/wp-content/plugins/` directory
 3. Activate the plugin through the ‘Plugins’ menu in WordPress

## 评价

![](https://secure.gravatar.com/avatar/ea81b0c53468da53bc500a52be1795dd717ea1749424e051eaab6842a1a5d063?
s=60&d=retro&r=g)

### 󠀁[Removed all content from my wordpress site](https://wordpress.org/support/topic/removed-all-content-from-my-wordpress-site/)󠁿

 [](https://profiles.wordpress.org/cefn/) 2018 年 5 月 21 日

I installed and activated the plugin through the Wordpress “Add New” Plugin wizard,
with no special configuration. I am running the plugin with the MH Magazine Lite
theme. As soon as it was activated, it caused all content from all pages to be removed
from the site. The content is not served at all (it’s not just a stylesheet display:
none issue). Fortunately deactivating the plugin allowed all my content to be served
again (it was still stored in the database, but couldn’t be viewed by visitors).

![](https://secure.gravatar.com/avatar/bd005d51e9459976798b6e2a370a6d089b2473ec1a604446004bc998e2eb801c?
s=60&d=retro&r=g)

### 󠀁[Fantastic!!!](https://wordpress.org/support/topic/fantastic-1622/)󠁿

 [alangrainger](https://profiles.wordpress.org/alangrainger/) 2017 年 11 月 11 日

Better than perfect, thanks so much!

![](https://secure.gravatar.com/avatar/e9d6b6220d7685c6db7830d814d48490da9168ae0b02523031443c051b7850dd?
s=60&d=retro&r=g)

### 󠀁[Awesome plugin! Great time saver! A few suggestions.](https://wordpress.org/support/topic/awesome-plugin-great-time-saver-a-few-suggestions/)󠁿

 [Evan Scheingross](https://profiles.wordpress.org/evster/) 2017 年 6 月 29 日

This plugin saved me a significant amount of time adding anchor links throughout
an existing website. It worked exactly as expected. My only suggestion would be 
a settings panel in the admin where users can specify exactly which header elements
get anchor links automatically associated with them. So for example, I can go in
and select “apply anchor links to <H4> only.” The ability to have a setting to turn
on/off the hover link icon would be very helpful too. I had to manually edit the
CSS to hide these icons on everything but H4’s in my entry content.

![](https://secure.gravatar.com/avatar/048a75b0011d7101d71202fcc26786eb0759aa0ff56a905d9c7692b51a98ec49?
s=60&d=retro&r=g)

### 󠀁[Works as expected…](https://wordpress.org/support/topic/works-as-expected-244/)󠁿

 [ramtinsoltani](https://profiles.wordpress.org/ramtinsoltani/) 2016 年 9 月 3 日

A very simple but effective plugin which saves a lot of time creating anchors for
headings.

![](https://secure.gravatar.com/avatar/7d6df8272c9ce91e397b8cb2e81336fdaa13bc39cf3f1dc5dc43f1086244bd7e?
s=60&d=retro&r=g)

### 󠀁[Extremely useful and simple](https://wordpress.org/support/topic/extremely-useful-and-simple/)󠁿

 [CMTV](https://profiles.wordpress.org/cmtv/) 2016 年 9 月 3 日

To tell the truth I had no hope searching for a plugin that would add links to headers.
And I was so surprised when this plugin did exactly what I wanted. Thank you, Per
Soderlind, for this plugin! P.S.: Sorry for my English, I am Russian.

 [ 阅读所有6条评价 ](https://wordpress.org/support/plugin/wp-anchor-header/reviews/)

## 贡献者及开发者

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

贡献者

 *   [ Per Søderlind ](https://profiles.wordpress.org/pers/)

[帮助将「WP Anchor Header」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/wp-anchor-header)

### 对开发感兴趣吗?

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

## 更新日志

#### 0.3.0

 * Requires WordPress 6.5 or later and tested up to WordPress 7.0.
 * Refactor heading parsing to avoid deprecated HTML entity conversion and preserve
   existing heading IDs.

#### 0.2.3

 * Tested & found compatible with WP 4.7.

#### 0.2.2

 * Tested & found compatible with WP 4.6.

#### 0.2.1

 * Fix: Don’t run if `the_content` is empty

#### 0.2.0

 * Update plugin for [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
 * Tested & found compatible with WP 4.5.

#### 0.1.8

 * Fixed UTF-8 parsing bug, added `mb_convert_encoding` to loadHTML(): `@$doc->loadHTML(
   mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8') );`
 * Added singleton
 * Added comments to code

#### 0.1.5

 * Initial release

## 额外信息

 *  版本 **0.3.0**
 *  最后更新：**3 周前**
 *  活跃安装数量 **400+**
 *  WordPress 版本 ** 6.5 或更高版本 **
 *  已测试的最高版本为 **7.0**
 *  PHP 版本 ** 7.2 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/wp-anchor-header/)
 * 标签
 * [header](https://cn.wordpress.org/plugins/tags/header/)[link](https://cn.wordpress.org/plugins/tags/link/)
 *  [高级视图](https://cn.wordpress.org/plugins/wp-anchor-header/advanced/)

## 评级

 4.3 星（最高 5 星）。

 *  [  5 条 5 星评价     ](https://wordpress.org/support/plugin/wp-anchor-header/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/wp-anchor-header/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/wp-anchor-header/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/wp-anchor-header/reviews/?filter=2)
 *  [  1 条 1 星评价     ](https://wordpress.org/support/plugin/wp-anchor-header/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-anchor-header/reviews/#new-post)

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

## 贡献者

 *   [ Per Søderlind ](https://profiles.wordpress.org/pers/)

## 支持

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

 [查看支持论坛](https://wordpress.org/support/plugin/wp-anchor-header/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://soderlind.no/donate/)