If I create a page with the slug "exams" and then need to change the page's slug from "exams" to "tests", any other pages in WordPress that link to the original permalink now have broken links as WordPress doesn't do any internal link checking when updating a page.

One way around this would be if WordPress inserted internal links with the default format of the page ID instead of the slug, e.g. /?p=123, as that never changes. Plus, when you navigate to the ID, the permalink setting in .htaccess are applied and change it to the slug automatically.

I saw a pretty slick solution in this post that does just this when using the visual editor, but I wasn't sure if there were any gotchas or drawbacks with this method.

Is there a more comprehensive way that doesn't rely on the visual editor to handle this? Since the above solution doesn't handle scenarios like pasting links or working in the text editor, I was thinking that a solution that hooked into the create/update action and searched the database to catch all the links might be more comprehensive, but I don't know what hook to start with.

While changing the permalink doesn't happen frequently, it's annoying that when it does any internal pages that point to the original link are now dead.

2 Answers 2


You could use this search and replace tool: search and replace by interconnectit

Apart from that you could put some redirects in your htaccess, but really the search and replace works great.

  • Thanks, however I'm looking for the process to be automatic.
    – j08691
    Aug 24, 2015 at 12:26

Most CMS' don't do internal link validation to ensure there are no HTTP errors like 404, 301, 302's etc. One way to always ensure your links are working properly is to use an automated link validation tool that checks your site daily for such errors. This way you can fix the issue before anyone sees it. One example of such a tool is www.linktiger.com

  • 1
    I'm not looking for a link validation tool, and the solution I linked to in my question does what I need well, but I wasn't sure what drawbacks (if any) there were. And I don't understand your first sentence. Internal link checking would prevent 404 and other errors, but you're saying that it wouldn't?
    – j08691
    Sep 23, 2015 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.