Building a news site in Wordpress. Importing articles from old, custom-built site. I want the imported URLs to be the same, to preserve SEO equity. The URLs should look like:
site.com/category/article-slug/2409230 (legacy id# at the end)
So each Post's full slug would be like article-slug/2409230 (with forward slash in the middle).
- Using Custom Permalinks plugin which lets me have forward slash ('/') in slug when editing an individual article.
- Using WP-All-Import plugin to manage the import process, all data & slug fields are normalized and ready to go.
- Updated sanitize_title_with_dashes function (described here) to allow forward slash ('/') in slug when importing.
Upon importing old articles, it's saving the slug as intended. Displays intended URL when I hover on View link, and checked the wp_posts DB entry to verify.
The problem is when I open that post, it does the following:
site.com/category/article-slug/2409230 301 redirect to
site.com/category/article-slug/2409230/2409230 which is a 404
If I Edit an imported post, update the slug, Save, revert slug, and Save again - it works properly (Custom Permalinks plugin is doing its job here). But I can't do that 27k times for all of these old articles.
Anyone know what's making Wordpress want to redirect the imported slugs? Or how I can avoid this and get the imported articles to load without manually editing each one?