Link to a section in WordPress allows to draw attention to specific page elements, and ultimately improve user experience on the page.
Easy navigation boosts SEO and improves user experience.
Having links to various pages help to navigate between pages. But, how to navigate between sections?
Luckily, we can use anchor links to achieve it.
In this article, you will learn how to create a link to another section on the page in your WordPress website.
An anchor link is an element of a web page that helps to create a link to another location on the same page.
The process of creating anchor links is mostly similar on how to add regular links in WordPress, but with a few little changes.
Add anchor link
WordPress makes it easy to add anchor links, without a need to install any new plugins.
To link to a specific section of a page, two (2) things are needed:
- Create anchor.
- Link to anchor.
Both these actions are possible to do in editor and menu.
The Block editor allows to create anchor (unique ID) for sections and elements on the page by providing simple options to add anchor links.
First, create an anchor for your section:
- In dashboard, open your page in the Block editor.
- Select the block you want to link to.
- Locate and open the Advanced section in the right sidebar.
- In HTML anchor field, enter a short and descriptive name. Use hyphens to separate multiple words. For example,
Next, create a link to the anchor:
- In the Block editor, select text you want to use as a link.
- Click the Link icon.
- Inside the address bar, enter a hashtag followed by the anchor. For example,
- Click the Apply button to create a link.
To apply this method for an anchor on a different page you need to add the full URL first followed by the hashtag and anchor.
Also, make sure to have the forward slash at the end of the URL before the anchor.
You can also link to a specific section of the page from your site menu.
Assuming the anchor created, using the method above, time to create a menu link to that anchor.
Use the Customizer to customize links in WordPress menu:
- In dashboard, go to Appearance → Customize.
- Click Menus link to open the Menus panel.
- Create a new menu or select the existing one.
- Click the Add Items button to open Custom Links options.
- Create a menu link to the anchor, using the same method as noted previously.
- Publish your changes when ready.
Remove anchor link
Removing the anchor link in WordPress is simple, and it requires the following two (2) steps:
- Remove the anchor from your section.
- Clear URL of the anchor link.
First, locate and select your section to remove the anchor, added to HTML anchor field in Advanced.
Then, locate and select your link to modify its URL by clicking on the Link icon again to preview link settings.
It’s important to have a user friendly WordPress site.
Thus, creating links to various sections on the page, or to a section on a separate page in WordPress, can help to improve user experience and to boost your SEO efforts.
Also, you can use professional WordPress themes to better represent your professionalism, having performant, accessible, and secure site.
Thank you for taking time to learn how to link to section in WordPress. Hopefully, this tutorial was useful for you.