anchor links

How to “Easily” Add Anchor Links in WordPress

What Are Anchor Links?

Anchor links, also called jump links or in-page links, are links that lead to another part of the page. If someone clicks on an anchor link, he doesn’t go to a new page but to another part of the same page.

Why We Need Anchor Links?

In our longer WordPress posts, we use anchor links to help users jump to the section they want to read. These links are commonly used in table of contents sections to allow users to navigate up and down a longer article without reloading the page.

Let’s start with a live example of anchor links.

Below is a list of all the topics we will cover in this guide. Go ahead and click on any of these links, and you’ll be taken to that specific section.

How to manually add anchor links in classic editor

Here’s how to create an anchor link / jump link to WordPress if you’re still using the old classic editor.

Step 1 : Create the anchor link

To create an anchor link, first select the text you wish to change and then click the ‘Insert Link’ button.

ce-anchorlink

Then, you need to add your anchor link with a # sign prefix followed by the slug you want to use for the link.

Step 2 : Add the ID attribute to the linked section

The next step is to point the browsers to the section you want to show when users click on your anchor link.

For that, you’ll need to switch to the ‘Text’ mode in the classic editor. After that scroll down to the section that you want to show.

ce-addanchor

Now go to the HTML tag you want to target. For example, <h2><h3><p>, and so on.

You need to add the ID attribute to it with your anchor link’s slug without the # prefix, like this:

<h2 id="best-coffee-shops-manhattan">

Now save your changes and click on the preview button to see your anchor link in action.

How to add anchor links in content builder option?

Go to Content Builder Option in your WordPress admin panel, and select the element/block you need to put anchor link to,

content builder

Now you need to add the id attribute to your slug option without the # prefix  like this,

content builder slug

The next step is to link this section to the required section/part you need user to jump from with # attached to the slug.

like this : 

menu slug

Conclusion

If you want to increase the number of visitors to your website and make the content more accessible to the masses, you should include jump links in your blog posts.

References