This post was originally published on November 26, 2012. The post has been rewritten to show you the new and much easier way to create anchor links in WordPress.
In the past, creating page jump links required diving into HTML code. In this updated post, you’ll learn a simple way to do it with a Heading Block.
What are Page Jump Links?
Page jumping also referred to as anchor links or HTML bookmarks, is where a site visitor clicks a link and is jumped to a specific place further down or up a long page. Normal links always point to the top of a page. Anchor links are particularly useful for creating an index at the top of long pages. Like this…
In this post, you’ll learn:
- How to create an anchor link in a heading block
- Tips for Naming Anchor Links
- How to link to the anchor
- How to link to an anchor point on a different page
To Create your HTML Anchor:
- Click + to add a heading block in your page or post
- Enter your heading text
- On the right side under Block Settings, click on Advanced
- Under HTML anchor enter a unique name. (number-1, for example)
Tips for Naming Anchors
- Each HTML anchor must be unique within a page or post
- No spaces between words in an HTML anchor
- Remember HTML Anchors are case-sensitive
- An HTML Anchor can include: hyphens (-), underscores (_), colons (:), periods (.)
Now, Link to the anchor
Once you have created your anchors, you can link to them. Here’s how:
- To create a link, type your text, or add an image or button. The text, button or image will be what you want your visitors to click on (the link) to go to another section in your page.
- Highlight your text, image or button
- Select the link option from the block’s toolbar
- Type in the HTML Anchor you created, starting with the hashtag (#) symbol. So, if you created an Anchor named “number-1” (like we did) you would type #number-1
- Click enter
Link to an anchor point on a different page
You can also link to an anchor on a different page by changing the link url and adding an anchor on that page. The url of the link would look like this https://domain.ca/otherpage#anchor.
So much simpler!
Now with the block editor in WordPress, it’s easy to create anchors in your pages and posts. It is so much simpler now without the need to edit code.
Extend your Learning…
If you liked this post, you’ll love our new WordPress Mastery Course. Perfect for anyone who wants to go from Mystery to Mastery