Recently one of our readers asked us how to anchor link from one WordPress page to another page with a specific location? An example could be link to an image on another page or post so when clicked, directly jump to that image.

In HTML, such links are known as bookmarks. Let’s see how to create bookmarking links in WordPress.

To create a bookmark link in WordPress between two different pages or posts, we need to create a link pointing to the target element with an assigned id attribute.

For example, if you are writing a post and want to create an anchor link pointing to a sub-heading somewhere in the middle of another post, the workflow will be:

Post A:

<a href=”otherpostURL#anchor-name“>Link to heading in Post B</a>

Post B:

<h2 id=”anchor-name”>Heading</h2>

bookmarking links in wordpress

In WordPress, to add an id attribute as above, you have to switch to Text editor from Visual editor.

wordpress text editor

While creating bookmarking link in your post, make sure to add #id at the end of the post URL link. See an example below.

wordpress bookmarking link example

When the anchor link will be clicked, it will take visitors to the linked post but automatically scroll to the location where you have added that id.

Additional Reading

Conclusion

In order to create a link from one page to an element of another page in WordPress, you have to create an id for that element and then link to that id.

Last thing, don’t forget to share this article and follow us on Twitter and Facebook

Gimme a Share pleeeaase!

Pin It on Pinterest

Share This