Within the main content editor of posts and pages, we can insert multiple links to other posts/pages:
<a href="http://example.com/hello-world/">Hello World</a>
What I am trying to do is get WordPress to automatically add the ID of, in this case, the Hello World post to the link. To try and clearly explain what I’m wanting, imagine I’m writing a new blog post and I put a link within the new blog post to my existing Hello World post.
<a id="4" href="http://example.com/hello-world/">Hello World</a>
Where in the above example our Hello World post has the ID of 4. I have been studying this answer to a different question but I haven’t quite figured out how to get the ID of the post/page I am linking to and add it to the anchor element. Incase we have more than one link pointing to the same post/page it might be safer to use the rel attribute instead:
<a href="http://example.com/hello-world/" rel="4">Hello World</a>