How to Create Anchor Links in WordPress

John Turner founder of SeedProd Posted by John Turner on March 3, 2017

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 long 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. To create anchor links in WordPress is not as straight forward 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 Link

  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 it source code.
    Create Anchor Link Text tab
  3. Now that you can see the pages’ source code you now just need to add this code to wherever you want to place an anchor. Not you can change the id and title in the tag to suit your needs.
    <a id="section1">Section 1</a>
  4. 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 to just to your anchor link and for the link use whatever the id is in your anchor tag preceded by a the hash symbol. So in my case the link would be:
    #section1
    Anchor Link Creation
  5. 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 on 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 follow by the hash id. The link above has this code as the link:
https://www.seedprod.com/how-to-create-named-anchor-links-in-wordpress/#section1

John Turner founder of SeedProd

By John Turner

John is the founder of SeedProd.com and a WordPress Developer with over 15 years of development experience.

Made with in Charleston, SC USA

Sale - Get all of our Plugins for just $99  Learn More