How to Add Anchor Links in WordPress Effectively

A great way to share a link to a specific section on your WordPress site is to create anchor links. This allows users to easily jump to that section from anywhere. However, do you know how to add anchor links…

How to Add Anchor Links in WordPress effectively?

A great way to share a link to a specific section on your WordPress site is to create anchor links. This allows users to easily jump to that section from anywhere. However, do you know how to add anchor links in WordPress effectively? In today’s blog, we will give you a definition of anchor links and provide you with a step-by-step guide to creating anchor links in WordPress. Let’s explore.

An anchor link is also known as a jump link or in-page link. When you click on an anchor link, it immediately takes you to another part of the same page. Thanks to that, users can quickly jump to the sections they are looking for.

Most websites use anchor links to create a table of contents for blogs that come with long content. By adding anchor links, users need only a few seconds to move to a specific section on the same page instead of wasting a lot of time reading your whole post.

In addition, this method helps your users have a better experience when browsing your website. This is especially true for long-form content.

Additionally, Google can also show tons of links from your pages as “jump to” links. These can help you improve the organic click-through rate for your WordPress website, because users might find something useful related to their query that you didn’t display in the meta description or title.

add anchor links in wordpress 1 1

Step 1: Create an anchor link

First of all, you need to choose the text that you would like to place a link to and then click on the Insert link button on the block toolbar.

add anchor links in wordpress

This will open the insert link popup, where you can add the URL.

However, instead of linking it to a URL/post/page, you have to enter an anchor name. You simply specify “#” as a prefix and enter the anchor name for the section that you want the user to jump to.

add anchor links in wordpress

Then, click on the “Enter” button to create the link.

After you have added the link, you can see it in the editor. Nevertheless, when you click on this link, it doesn’t do anything. So, let’s move on to the next step.

Step 2: Add the ID attribute to the linked section

To do this,  firstly, place the cursor on the header or section you want your anchor link to jump to. Then, click on the three-dot menu on the block settings and choose “Edit as HTML” to switch over to the text view (HTML) in the editor.

add anchor links in wordpress

Then, let’s add ID along with the anchor name that you entered in step 1. You should notice that the anchor name and ID attribute must be exactly the same for the link to work.

add anchor links in wordpress 6

To switch back to the visual editor, click on the “three-dot” and select the “Edit visually” option to preserve the changes you made.

add anchor links in wordpress

The process of adding anchor links in the Classic editor is the same as in the WordPress Block editor. You can see the following steps.

Step 1: Create an anchor link

Initially, you need to choose the text that you want to become the anchor link and then click on the “Insert link” button in the toolbar.

add anchor links in wordpress 8

Next, you have to add your anchor link with a “#” character as a prefix followed by the anchor name. Don’t forget to click the “Enter” button to create the link.

Step 2: Add the ID attribute to the linked section

Next, you need to define the section you want to display when users click on your anchor link.

To do that, you need to switch from the Visual editor to the Text editor by clicking on the “Text” tab in the Classic editor. Then, place the cursor at the section you want to display.

add anchor links in wordpress 9

Now, you need to add the ID attribute to the HTML tag you want to target followed by your anchor name without the # character. For example:

<h2 id=”manually-add-anchor-links-in-wordpress-block-editor”>How to Manually Create Anchors Link in WordPress</h2>

Then, you can click on the “Save Draft” and see your anchor link in action by clicking on the “Preview” button.

If you don’t want to touch HTML code, don’t worry: there are still a few useful plugins that help you easily add anchor links and even create a table of contents for your post.

The plugin that we would like to introduce is the Easy Table of Contents Plugin. This is one of the remarkable WordPress table of contents plugins. To use this method, you need to follow the steps below.

Step 1: Install and activate the plugin

The process of installing this plugin is also the same as you did with other plugins. For more support, you can access our step-by-step guide on how to install a WordPress plugin for beginners.

Step 2: Configure the plugin’s settings

Once you have activated the plugin, let’s navigate to the Settings > Table of Contents page to configure the plugin’s settings.

On the settings page, you need to pay attention to the following sections:

  1. The “Enable support” option enables you to select which post types you want to use the table of contents on. By default, the plugin will be enabled for pages. However, you are able to enable it for your posts as well.
  2. The “Auto-insert” option allows the plugin to automatically create the table of contents for all posts of the selected types. If you want to create a table of contents manually for specific posts, you can uncheck these boxes.
  3. The “Show when” option permits you to define the number of headings that the post should have before a table of contents is displayed. For example, if your website has long-form posts, you should set it to at least four headings.

add anchor links in wordpress 10 1

Let’s scroll down the screen to the Advanced section. From here, you can select the headings you want to display as anchor links.

add anchor links in wordpress 11

There are also many other advanced settings. For example, you can select a theme, adjust width and height, set the font size, create a custom color scheme for your table of contents box, and much more. You can choose and adjust them to suit your requirements.

Once you are pleased with your selections, don’t forget to click on the “Save Changes” button at the bottom of the page.

Step 3: Add a table of contents to the page/post

If you enable the Auto Insert option, now the plugin will automatically add a table of contents to posts based on the settings that you selected in step 2.

add anchor links in wordpress

So, open an existing post with multiple headings and simply preview it to see the table of contents in action.

The bottom line

As you can see, there are a lot of ways to add anchor links in WordPress. However, we selected and shared with you the easiest methods to help you handle this task effortlessly. Hopefully, through this post, you can create a professional table of contents for your posts, which will help you improve CTR on your organic listing. Moreover, if you have any questions, please let us know by leaving a comment below.

Furthermore, it’s time to drop by our Free WordPress Themes where we specialize in providing plenty of gorgeous, powerful, responsive designs for your successful website.

Build it with a template

Start from a finished design: Joomla templates, WordPress themes or the AI-ready block themes. Every template has a free version and a live demo.

Free download

We'll send the link, setup tips and update notices, and you can reach us anytime through our AI assistant and contact form.

The download starts at once. We email you the link and ask you to confirm your address. Privacy policy.