1

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.

3 Answers 3

1

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.

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

The only plugin that I know doing this is Slim SEO Link Manager. The plugin has a feature that automatically updates all internal links to a specific post when its slug changes. So you can update your slugs freely without worrying about broken links.

Just a note that if you change the permalink structure, the plugin can't detect the change and can't update links to posts for you. In this case, you might need to update all links using the Bulk Updater feature in Slim SEO Link Manager, or use a plugin like Better Search Replace to update the URLs.

-1

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
  • 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
    Commented Sep 23, 2015 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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