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
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.
To Create an Anchor Links
- Select and edit the page or post you want to create anchor links within.
- Next, click the “Text” tab on the post/page to view its source code.
- 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>
- 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:
- 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.
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: