mass changing wordpress permalinks

so I have this odd question that may not be possible to answer… Not really sure, but whatever; I’ll ask it anyways… I have a permalink structure as follows:

www.mydomain.com/courses/economics/gdp/gdp-lesson www.mydomain.com/courses/economics/gdp/gdp-test

www.mydomain.com/courses/economics/demand/demand-lesson www.mydomain.com/courses/economics/demand/demand-test

www.mydomain.com/courses/economics/supply/supply-lesson www.mydomain.com/courses/economics/supply/supply-test

And I have hundreds of pages at the end of the permalink like that. This is on a wordpress installation, so the page titles respectively are:

Read More
GDP - Lesson
GDP - Test

Demand - Lesson
Demand - Test

Supply - Lesson
Supply - Test

I’d like to see if it’s possible to run some code or a script or something (idk) that will just modify the permalinks for each of these pages to make them look like:

www.mydomain.com/courses/economics/gdp/lesson www.mydomain.com/courses/economics/gdp/test

www.mydomain.com/courses/economics/demand/lesson www.mydomain.com/courses/economics/demand/test

www.mydomain.com/courses/economics/supply/lesson www.mydomain.com/courses/economics/supply/test

while keeping the page titles and everything else the same. I’m not sure if this is possible without screwing up a lot of stuff. If anyone could figure this out, I’d be forever grateful!

Related posts

Leave a Reply

1 comment

  1. Maybe you could export your database as a .sql file and open the .sql file in a text editor. From there, you can run a find and replace to change it to what you would like. Keep a back up of your database just incase you make a mistake.