How to Create Anchor Links in WordPress

Anchor

What are anchor links?

Whilst you might expect to land at the top of a web page when you visit a website, anchor links, sometimes known as jump links, take you directly to a specific part of a web page. This can be achieved manually in WordPress without the use of additional plugins.

Why use anchor links?

Using anchor links will allow users to find what they need quicker by jumping straight to the section they are interested in giving a better user experience.

Anchor links can also be used on other websites and social media to link users to a specific section of a web page on your site. This is ideal when you want to instantly send users to the most important part of your content.

01. Edit the HTML of the Section Header

Open up the editor of the page where you would like to add the anchor link. Locate and select the header of the section you would like to link to. Click the more options icon (three dots stacked vertically) and hit ‘Edit as HTML’.

Edit the HTML in WordPress

02. Add an ID attribute

This part may seem daunting to anyone who has never written code before but it really is simple. Place your cursor before the first closing angle bracket and add the following id=”my-anchor-section” Replace “my-anchor-section” with any name you wish, we recommend something short and related to the content but do not use spaces.

Click the more options icon again and hit “Edit Visually” to hide that scary HTML and publish/update the page.

Add an ID attribute in WordPress

03. Creating the URL

In order to link to this section of your page, your URL should point to the page containing the section followed by the ‘#’ character and the name you gave your section in the previous step. The URL structure should look something like this yourdomain.com/your-page/#my-anchor-section

This can be checked by visiting the link directly in the browser. Once you’re sure it’s working the URL can be used to link to this section from within the website itself, or using from outside sources such as social media.

Anchor link URL Structure