How to Fix Internal Links to a Deleted WordPress Page or Post

first_imgImagine you’ve had a website for a few years. And you have a page or post that you no longer want on your site.Instead, you want your readers to visit a different post or page. So you delete the old page or post.Problem solved, right? Not exactly. What Happens When You Delete a Page or PostOnce you’ve removed a page or post from your site, the content is gone. But your internal links to that page or post still exist. They may be links from posts, pages, your menu, footer, or sidebar. Which means, unless you take action, your readers will be directed to your Page Not Found page explaining that the page or post no longer exists.Your readers may get frustrated that they’ve discovered a broken link. They might use your search tool to look for the page or post. Or they may leave your website completely because they haven’t found what they were looking for. That’s something you want to avoid. How to Fix Internal Links to Deleted Posts or PagesYou want to identify and update your internal links so readers will be directed to the page or post you want them to find. That task might sound easy, but it depends on your website.And when it comes to WordPress, you have a number of options available to you, depending on your site setup. Here are the three options I currently recommend.1. Manually updateIf your site is a small site, with only a few pages or posts, you can invest the time to manually update the links to point to the page you want your readers to find. This can work well when your site is small.But if your site is large, and links are scattered all over your site, you don’t want to be manually looking at every page or post for a link to the deleted content. You’ll want to look into automated options to update your content to point to the new page or post. Read on for the second and third options.2. Use a Search and Replace pluginA search and replace plugin allows you to easily search for links and replace them with the link to your preferred post or page. Note: you must backup your database before using the plugin. You’ll find dozens of search and replace plugins in the WordPress repository, but one of my favorites is Better Search Replace. It’s a popular plugin with an average four-and-one half-star rating in the WordPress repository. One of the reasons I like Better Search Replace is that the interface is easy to use. Once you’ve installed and activated the plugin, look in your Dashboard for Tools > Better Search Replace.You’ll be presented with the Better Search Replace administrative page where you can enter the old URL in the Search for form field and the new URL in the Replace with form field.I keep the enabled setting (currently one of the last options on the page) to Run as dry run? It lets me review the changes before I make them. If checked, no changes will be made to the database, allowing me to check the results before I make the changes.Select Run/Search Replace to make your changes.Once you’ve confirmed your changes were made correctly, you’ll want to deactivate and remove the Better Search Replace plugin from your site. There’s no need to keep the plugin installed after you’re done making the change to the new URL.3. Use a 301 Redirect PluginA 301 redirect is a permanent way to redirect from one URL to another URL on the website. It will send your site visitors automatically to the different URL than the one they entered in their browser or the one they found in search engine results. Think of a 301 redirect like forwarding your mail when you’ve physically moved to a new street address. You request mail to be forwarded at your local post office. And the mail system in your country makes sure old mail received at your old address is automatically forwarded to your new address.And you don’t have to worry about it. The mail system takes care of it for you.That’s exactly how a 301 redirect works on websites. Once set up, the 301 redirect will seamlessly send your website visitors to the different URL.WordPress has many different ways you can set up 301 redirects. You can edit your .htaccess file, but it can be a lot easier for many people to use a plugin. My current recommendation is to use the Simple 301 Redirects plugin, a free plugin in the WordPress repository. Once you’ve installed and activated Simple 301 Redirects, you can add redirects from the Settings > 301 Redirects page. Their interface only has two form fields, the Request form field is where you enter the old URL. The Destination form field is where you enter the URL for the page you want readers to be directed to.Note: what you enter in the Request form field should be relative to your WordPress root. That means what you enter in the Request form field will begin with a backwards slash character. Check their documentation for examples.What you enter in the Destination form field can be a relative or absolute URL.Once you’ve select Save Changes, the redirect will be in place. If it’s not as you expected, check that you’ve entered the URLs correctly.SummaryDeleting a page or post on your WordPress site isn’t a one step and you’re done process. You’ll want to check whether the page or post you plan to delete is linked from locations on your site.If it is, use one of the three methods I recommended to make sure your readers find what they’re looking for on your site. Share this:Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)Click to print (Opens in new window)Like this:Like Loading…RelatedHow to Check Broken Links on Your WebsiteBroken links on websites. Nobody wants them. People visiting your site get frustrated when they come across a broken link. Website visitors may think, “Can I trust this website if it has broken links?” Website owners don’t like broken links. They’re tedious to fix and it takes time. Search engines…In “Web design”10 Basic Tips for Getting Started BloggingRecently I was reviewing archived notes from when I first started blogging with WordPress. And it reminded me of when I helped set up WordPress multisite at Washtenaw Community College (WCC), where I worked as a web developer in the early 2010’s. To help department staff get started blogging on…In “Blogging”Why That Tweet Isn’t Displaying in Your Blog Post and What You Can Do About ItI noticed the problem a few weeks ago. One of my posts wasn’t displaying the tweet I embedded in the post. Instead, the post was showing the tweet URL. Hmmm, I wondered. What happened? Did I add an extra character to the URL? Troubleshooting the Missing Tweet To check, I…In “Blogging”last_img

Leave a Reply

Your email address will not be published. Required fields are marked *