How to Add Anchor Links in WordPress

If we write a long blog post with many subtopics, it’s a good idea to add anchor links to the top of the posts. It’s a type of link that lets the reader to quickly jump to the article section in which they are most interested in. That is great for user experience since they immediately get what they want. Although it may lower the time they spend on the page.

There a few ways how you can add anchor links to the content both manually and automatically. I’ll show you some.

1. Use a table of contents plugin (TOC)

That is the simplest way since it doesn’t require any manual work. You just download and activate the plugin, set if it adds the table of content automatically, or via shortcode. Of course, depending on the plugin, there are some settings available to customize the look.

There are many plugins available for free; here are the best ones.

Here the settings for Easy Table of Contents.

Easy Table of Content Settings

2. Add custom anchor link manually using Gutenberg editor

If you want to create custom anchor links to subheadings, you can easily do that, too. You need a minimal code editing. That is useful to make a customized table of content or exclude/include subheadings.

Here are the steps:

  • Add ID to the subheading block by switching to HTML editor. For example, you have a subheading “Best Tables for home.” The ID might be “tables.”
<h2 id="best-tables-home">Best Tables for Home<h2>
  • Create the text, click on “Add link” and add the previously added ID, in this case, the best-tables-home with # before it, so it looks like this:
  • Click apply, and you are ready.

3. Add custom anchor manually using the classic editor

You need to do almost the same.

  • Switch into text mode and find the heading you want to use.
  • Add the ID. It will look like this:
<h2 id="best-shoes-running">Best Shoes for Running<h2>
  • Get the text and click on the “Insert link.”
  • Add ID with # so it’ll look like this:
  • Apply

I hope now you can create links in your posts that jump to the section you want. The readers will love it since they can quickly find what they want.


Imre Bucko

I'm a big fan of the internet and all the stuff on it. I'm particularly interested in internet marketing, SEO, and WordPress. That's why I've been working at home building sites for more than 10 years.

Leave a Reply

Your email address will not be published. Required fields are marked *