Every guide I have read insists on downloading a plugin (usually their own, of course) to help you find all internal links pointing to a particular post or page.
But this is complete nonsense! WordPress has its own built-in search feature that does a perfectly fine job of locating links throughout your website – as long as you know how to use it.
In fairness, some of the plugins I looked at come with extra features, but if you only have the straightforward aim of finding specific links in your posts and pages, perhaps because they need fixing or updating, then this method is for you.
Again, we are showing you how to hunt down permalinks with the built-in Search widget. It may not work if you’re using a search plugin or if your theme uses its own search function.
If indeed your theme is overriding the built-in search feature then consider switching themes temporarily to one of the default WordPress themes such as Twenty Sixteen.
Find internal links with the Search widget
You can’t conduct any searches without enabling the Search widget. If you haven’t done so yet, navigate to Appearance > Widgets and add it to your sidebar (or wherever you want it to be).
Let’s say you recently edited the title of one your blog posts. It’s changed from ‘How to Eat Apples’ to ‘How to Eat Red Apples’ and, more importantly, you also changed the permalink from:
example.com/how-to-eat-apples/
to:
example.com/how-to-eat-red-apples/
You want to find all the pages and posts containing the old permalink and update them, otherwise your readers will encounter broken links and abandon your site. So, how do you find them?
Search for the slug
We have already established that the Search widget will help you find all internal links pointing to the old blog post URL. Therefore, a better question is “What goes in the search bar?”
Answer: the URL slug
The slug is the last part of the URL and serves as a unique identifier for the post/page. In our example, how-to-eat-apples and how-to-eat-red-apples are slugs.
Even if you have a longer permalink structure such as example.com/fruit/how-to-eat-apples, the last part of the URL is still the slug.
When you do a search for “how-to-eat-apples“, the results will display every page or post containing links to example.com/how-to-eat-apples:
After updating all your internal links to reflect the new URL, searching with the old slug will return 0 results, which is precisely what you want to happen, as URLs with this slug no longer work.
Remember to make a temporary switch to a default WordPress theme if this method isn’t working in your normal theme. In fact, you may not even have to activate the new theme if you can find the search bar using the Live Preview option.
Limitations
If the slug consists of a single word, you will run into issues with this method for finding internal links to posts and pages in WordPress.
To use an extreme example, imagine example.com/the/ was your blog post URL… You would have to search for “the” to find internal links pointing to it, which will obviously generate lots of results.
Ultimately, you shouldn’t have this problem because all your slugs should be descriptive. However, it’s not unusual for certain pages to have one-word slugs such as the Contact and About pages.
Summary
Finding internal links to a particular post or page in WordPress is easy with the built-in search feature.
Just enter the link’s URL slug into the search bar and WordPress will show you all pages and posts that contain the link.