How to Create Anchor Links in WordPress?

To create anchor links in WordPress is not as simple as it should be but follow the steps below, and you’ll easily be able to make it

By Claudio Pires
Updated on August 16, 2022
How to Create Anchor Links in WordPress?

In this “how-to” series, I’m going to show you have to create named anchor links or some people call them anchor tags in WordPress. If you have different sections in a lengthy post or page and you want the visitor to be able to click on a link, say in a table of contents you create, to jump to a different section of that post, then you’ll want to use an anchor link.

Creating anchor links in WordPress is not as straightforward as it should be. But just follow the steps below, and you’ll easily be able to create anchor links with no coding skills.

  1. Select and edit the page or post you want to create anchor links within.
  2. Next, click the “Text” tab on the post/page to view its source code.
Next, click the “Text” tab on the post/page to view its source code.
  1. Now that you can see the pages’ source code. You just need to add this code wherever you want to place an anchor. You cannot change the tag’s id and title to suit your needs.
    <a id=”section1″>Section 1</a>
  2. You can now switch back to the Visual tab to create the link. To create the link, highlight the text you want the user to click on just to your anchor link and for the link, use whatever the hash symbol in your anchor tag precedes the id. So in my case, the link would be:
    #section1
Text tab WordPress classic editor
  1. And that’s it! Save and Publish or Preview your Draft to test. In my example, when I click “How to Resize an Image in WordPress,” it will take me to that section. Click the previous link to see a live example.

Note

You can also create named anchor links across pages. So as you can see in the example above, instead of jumping to a different section of this post, we navigated to a new URL and then jumped to that section. To do that, just when creating the link, enter the URL to the page you want to navigate to, followed by the hash id. The link above has this code as the link:
https://www.visualmodo.com/how-to-create-named-anchor-links-in-wordpress/#section1

Claudio Pires

Claudio Pires is the co-founder of Visualmodo, a renowned company in web development and design. With over 15 years of experience, Claudio has honed his skills in content creation, web development support, and senior web designer. A trilingual expert fluent in English, Portuguese, and Spanish, he brings a global perspective to his work. Beyond his professional endeavors, Claudio is an active YouTuber, sharing his insights and expertise with a broader audience. Based in Brazil, Claudio continues to push the boundaries of web design and digital content, making him a pivotal figure in the industry.