Join Morten Rand-Hendriksen for an in-depth discussion in this video Creating and editing links, part of WordPress 4 Essential Training.
- [Voiceover] One of the reasons for the creation of, and the popularity of the web, is the ability to create hyperlinks within or between documents. When we use the web today, it's hard to remember a time when you couldn't simply click on a link on the web to get the information you wanted. Now it's time to create links in WordPress, both through content on the wider web and also to content within our own site. Now how we add, edit, and remove links has been changed in WordPress 4.5 and 4.6, so today the operation is a little bit different from what you may be used to. By far the easiest way of creating a link in the newer versions of WordPress is to first find the link in question, so in this case an article of Wikipedia about dietary supplements.
From here copy the link URL, Control or Command + C, then go to the WordPress Editor in your post or page, and highlight the content you want to turn into a link. That could be a single word, a sentence, or an image, or something else. I'll highlight this sentence here, supplements and nutritional products, and then simply paste the copied link on top of this highlight, Control or Command + V. This automatically creates a link for us and we get this nice tool tip, telling us exactly where we are pointing with this link.
So if I click anywhere else and then click back on the link, you'll see the tool tip up here, I can see where the tool tip is pointing. If I click on the link, I go directly to the article to make sure it works. And if I want to edit the link, I click the edit button. This opens the URL field for editing, so here I can change the link if I want to, and if I want to make further edits I can also click this wheel here, link options, that opens the Insert/edit link dialogue from which I can change the URL, change the link text, so that is the display text in the post or page, and most importantly I can toggle this Open link in a new tab box on and off.
Now here's a simple rule of thumb, if you're linking to content within your own site and you think people should go there and read that content instead of where they are right now, don't check this box. However, if you're linking to ancillary content or you're linking to something that's on a different site and you don't want people to leave yours, it's a good idea to check this box. That way people click on the link, a new tab or window opens, and they'll be able to return to your site later. So this is an external link, I will check this box.
When I click Update, the link is now updated and everything will work the way I expect. If you're paying close attention, you'll notice when I click on the link a feature highlights on the WordPress toolbar. Here we have two buttons that relate to links, Insert/edit link that will take us directly to the tool tip, and also Remove link. Now Remove link works exactly the same as the X inside the link tool tip. It simply takes the link away. So for practical purposes, I find it's much easier to remove a link by simply clicking on the link and then clicking the X than clicking on the link and then going up to the toolbar and clicking Remove link, but these two buttons are there for legacy purposes.
This used to be how we managed links. So you may wonder, why on Earth do we still have these buttons if we can just do everything within our own content? Well there might be times when you want to link the content within your own site and in those cases we need to use these buttons, so let me show you how that works. First I'll scroll down and find what I want to turn into a link. In this case the words, active lifestyles. Then, I want to create a link and I do that by clicking Insert/edit link. This opens a tool tip, only this time we haven't pasted in a URL yet.
So it tells us, paste URL or type to search. So if I had an external link, I could simply paste in the URL, but if I want to search for content within my own site I can do a free text search. So for example, I could search for the word next and see if anything shows up. Here we have a page, Are You Ready for the New You? If I click that link, I automatically create a link to that page within my site. But there's something weird going on here, and that's because of my rather strange setup.
You see now that I created a link it has this red outline, technically that means there's something wrong with the link and it's not working. This only works for internal links and as you see it's a little bit buggy. So what's happening here is my very strange install isn't quite understanding that this link in fact works fine, and if I click on the edit button and go to the link options wheel, you'll see the URL here is correct, so this will actually work but for whatever reason WordPress doesn't quite understand a local install, so that's why you're getting that red line.
I can fix that by taking the domain name away for now, but that's not something you should be doing on a live site. What I do want to show you here is, if you can't remember what you're looking for. If you have hundreds of posts or a new page and you can't remember the title, you can also go into Insert/edit link and scroll through all the content on your site. Here you see you have a much more elaborate list. Of course the search still works, if I search for New, we get Are You Ready for the New You? But you can also cross out the search and go through all of your content and select exactly the post or page you want to link to.
Once you've created the links on your page, as with everything else, it's important to test that everything works properly. So click Preview, follow each of the links. This is the one that should open a separate tab to Wikipedia, and it does. And when I scroll down this link should take us directly to another page within our site, and it does. That means everything is working properly, and I can move on to the next steps.
Note: This course covers an older version of WordPress, which features the Classic Editor. Watch this course only if you are using the Classic Editor plugin or using WordPress 4.9 or earlier. Otherwise, watch WordPress 5 Essential Training, which covers the new Block Editor experience.
- Creating posts and pages
- Formatting text
- Publishing and scheduling posts
- Adding images, audio, and video
- Bulk editing posts and pages
- Customizing themes and menus
- Using widgets
- Extending WordPress with plugins
- Editing users profiles
- Configuring settings
- Getting new readers
- Keeping WordPress up to date and secure