Title: Headings as link targets
Author: WordPress.org
Published: March 2, 2021
Last modified: October 14, 2026

---

# Headings as link targets

## In this article

 * [Adding an anchor](https://make.wordpress.org/docs/style-guide/linking/heading-targets/?output_format=md#adding-an-anchor)
 * [Changing an anchor](https://make.wordpress.org/docs/style-guide/linking/heading-targets/?output_format=md#changing-an-anchor)

 **Highlight:** Use heading anchors.

Heading anchors are useful for document sections that are frequently linked to. 
To make headings into link targets, add an anchor. To avoid breaking existing heading
links in published content, create an anchor that uses the same ID string as the
published page. You can also create a custom anchor for a heading; for example, 
you can create a short anchor for a long heading. A custom anchor decreases the 
possibility of breaking existing links if the heading text changes.

## 󠀁[Adding an anchor](https://make.wordpress.org/docs/style-guide/linking/heading-targets/?output_format=md#adding-an-anchor)󠁿

 **Note:** For content published on wordpress.orgWordPress.org The community site
where WordPress code is created and shared by the users. This is where you can download
the source code for WordPress core, plugins and themes as well as the central location
for community conversations and organization. [https://wordpress.org/](https://wordpress.org/),
WordPress may automatically create a link target for headings by default. For more
information about creating heading anchors on WordPress, see [Page jumps](https://wordpress.org/support/article/page-jumps/).

{% codetabs %}
 {% HTML %} To add an anchor to a heading in HTML, do the following:

 * Add a `<section>` element with an `id` attribute. Don’t use `<a name>`.
 * Use lowercase for `id` values.
 * Insert hyphens between words.

**Examples**

 **Not recommended:**

    ```notranslate
    <h2><a name="Determining_Plugin_And_Content_Directories">Determining plugin and content directories</a></h2>
    ```

 **Not recommended:**

[code lang=htmlHTML HTML is an acronym for Hyper Text Markup Language. It is a markup
language that is used in the development of web pages and websites.]
 <a name=”Determining_Plugin_And_Content_Directories”
></a> <h2>Determining pluginPlugin A plugin is a piece of software containing a 
group of functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories</h2> “`

 **Acceptable:**
 “`htmlHTML HTML is an acronym for Hyper Text Markup Language. 
It is a markup language that is used in the development of web pages and websites.
<h2 id=”determining-pluginPlugin A plugin is a piece of software containing a group
of functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party.-and-content-directories”>Determining
plugin and content directories</h2> [/code]

 **Recommended:**

    ```notranslate
    <section id="determining-plugin-and-content-directories">
    <h2>Determining plugin and content directories</h2>
    ...
    </section>
    ```

 
 {% Markdown %} To add an anchor to a heading in Markdown, do the following: –
Add `{:#ID_OF_ANCHOR}` after the heading, to the end of the line that the heading
is on. Replace `ID_OF_ANCHOR` with the ID for this heading. – Use lowercase for `
id` values. – Insert hyphens between words.

**Examples**

 **Not recommended:**

## Determining pluginPlugin A plugin is a piece of software containing a group of
functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories {: id=”ID_OF_ANCHOR”}

 **Not recommended:** (Note single quotation marks)

## Determining pluginPlugin A plugin is a piece of software containing a group of
functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories {: id=’ID_OF_ANCHOR’}

 **Not recommended:**

## Determining pluginPlugin A plugin is a piece of software containing a group of
functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories
 {:#ID_OF_ANCHOR}

 **Acceptable:**

## Determining pluginPlugin A plugin is a piece of software containing a group of
functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories {: id=”determining-
directories” }

 **Recommended:**

## Determining pluginPlugin A plugin is a piece of software containing a group of
functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories {:#determining-
plugin-and-content-directories}

 **Recommended:**

## Determining pluginPlugin A plugin is a piece of software containing a group of
functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. and content directories {:#determining-
plugin-content-directories}

 
 {% end %}

## 󠀁[Changing an anchor](https://make.wordpress.org/docs/style-guide/linking/heading-targets/?output_format=md#changing-an-anchor)󠁿

 **Note:** For content published on wordpress.orgWordPress.org The community site
where WordPress code is created and shared by the users. This is where you can download
the source code for WordPress core, plugins and themes as well as the central location
for community conversations and organization. [https://wordpress.org/](https://wordpress.org/),
WordPress may automatically create a link target for headings by default. For more
information about creating heading anchors on WordPress, see [Page jumps](https://wordpress.org/support/article/page-jumps/).

To change an anchor, you need to create a custom anchor that uses the older ID string.
A custom anchor decreases the possibility of breaking existing links if the heading
text changes. You can find the ID string by inspecting the heading.

{% codetabs %}
 {% HTML %}

If you change a heading from _Custom template files_ to _Custom post type template
files_, then add a custom anchor that uses the older ID string and formatting.

**Example**

 **Recommended:**

    ```notranslate
    <section id="custom_template_files">
    <h2>Custom post type template files</h2>
    ...
    </section>
    ```

 
 {% Markdown %}

If you change a heading from _Custom template files_ to _Custom post type template
files_, then add a custom anchor that uses the older ID string and formatting.

**Example**

 **Recommended:**

## Custom post typeCustom Post Type WordPress can hold and display many different
types of content. A single item of such a content is generally called a post, although
post is also a specific post type. Custom Post Types gives your site the ability
to have templated posts, to simplify the concept. template files {:#custom_template_files}

 
 {% end %}

First published

March 2, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: Headings as link targets ](https://github.com/WordPress/WordPress-Documentation-Style-Guide/edit/main/docs/6-linking/heading-targets.md)

Changelog

[ See list of changes: Headings as link targets ](https://github.com/WordPress/WordPress-Documentation-Style-Guide/commits/main/docs/6-linking/heading-targets.md)

[  Previous: External links](https://make.wordpress.org/docs/style-guide/linking/external-links/)

[  Next: Image links](https://make.wordpress.org/docs/style-guide/linking/image-links/)