How We Fixed News Post Imports in WordPress (And Prevented Broken Links)

Issue Background

During the migration of a legacy WordPress site to a new environment, two major problems appeared after the first import:

➡️ Duplicate Featured Images:


Multiple news posts ended up displaying the same featured image, hurting visual consistency across the WordPress site and dashboards.

➡️ Broken External Links:

A custom “external link” field triggered errors if the URL wasn’t perfectly formatted with https://, causing broken links, broken URLs, and broken outgoing links that frustrated users and led to 404 errors.

Both issues made the new site look unprofessional, broke user trust, and created numerous broken links across content for broken pages and posts.

Diagnosis


We ran a detailed audit of the import scripts, custom fields setup, and plugins like ACF and Better Search Replace:

✔️ Duplicate images came from a scraping tool that didn’t handle similar metadata properly—often assigning one featured image to multiple posts.

✔️ Broken external links traced back to strict URL validation rules rejecting plain text or incomplete URLs in the external link field, which could lead to broken links on your WordPress site and broken internal links in posts.

Resolution Steps

1️⃣ Refining the Import Script


Rebuilt the import process to fetch individual featured images for each post, guaranteeing unique images across the WordPress website and ensuring the site was free of broken links.

2️⃣ Image Optimization


Manually resized and compressed oversized featured images to reduce page load times and improve site performance.

3️⃣ Fixing the External Link Field


Converted the external link field from strict URL validation to plain text, avoiding broken URLs, broken outgoing links, and bad links, while keeping flexibility for editors.

4️⃣ Conditional Logic for Display


External links now open in new tabs as outbound links, while internal posts remain native, providing proper internal linking and a seamless user experience.

Final Outcome


With custom coding, content clean-up, plugin configuration, and thoughtful UI handling, the chaotic import became a polished news archive. Every post now displays correctly, links work across the site, and broken links were fixed or removed. Using tools like a broken link checker plugin, Better Search Replace, or plugin like Broken Link Checker made it easy to find and fix dozens of links, keeping your WordPress site free of broken links and ready for search engines.

Comments

Leave a Reply

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