• Hey everyone,

    I’ve migrated my site back from Ghost to WordPress, which I took as an opportunity to update the permalink structure of my roughly 200 pages and roughly 900 posts.

    I have already bulk added 301-redirects from all old to new slugs by bulk uploading a .csv to the Redirection plug-in, which worked great.

    However, for my internal links in my posts and pages, I would not like to rely on those redirects. Instead, I’d love to find a Search and Replace option that allows me to edit all slugs in bulk. As I mentioned, I’ve got all 1100 source URLs and target URLs nicely aligned in an Excel document. The plug-ins I found (such as “Better Search and Replace”) only allow one replace command at a time, which would take way too long. I think an SQL query could do it, but I’ve never used those before and don’t know which formatting to use for thousands of links.

    It would be amazing if someone would have some advise! ??

    Cheers,
    Brief

    • This topic was modified 2 years, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • The plug-ins I found (such as “Better Search and Replace”) only allow one replace command at a time, which would take way too long. I think an SQL query could do it, but I’ve never used those before and don’t know which formatting to use for thousands of links.

    The plugin simply runs the SQL for you you. So a plugin or SQL, per se, makes no difference.

    A simple SQL query needs a common pattern among all the URLs to do a mass search-and-replace. That’s what these plugins do.

    So is there such a common pattern between your old and new URLs? If there’s such a pattern, then you can input simple regex or wildcard URLs into a plugin like Better Search and Replace to find all matching URLs and replace them at once.

    If there’s no such pattern, then you’re going to need some sort of script to loop through all the old URLs individually, find each one in the database, and replace them with the new ones.

    Thread Starter briefschreiben

    (@briefschreiben)

    Dear George,

    Thanks so much for your reply.
    Unfortunately, there’s no common pattern between my old and new URLs because I’ve added new subfolders for my pages, changed the permalink structure of blog posts, and tweaked other things.
    So what I’m searching for (and what I guess I erroneously called an SQL query) was exactly what you’re describing: A script to loop through all the old URLs individually, find each one in the database, and replace them with the new ones. Because as I said, I’ve got all source (old) and target (new) URLs lined up in an Excel already, and would just need some way of feeding them into WP.

    With best wishes,
    Lennart

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bulk search and replace (for 1000s of URLs)’ is closed to new replies.