Welcome to the forum. If this is your first time you can browse around and see what you like. You will need to be registered in order to post!

Join our community and talk about tech, gaming, get support for computer problems and even sale your own product.
Considering supporting us by subscribing.

Mass replace Old URL/Bad Links In Wordpress Post

Wanted to know more about how to improve your site? Ask here!
Post Reply
User avatar
kachan64
USER_STATUS: Offline
Site Admin
Site Admin
Posts: 45
Joined: Sat Jul 01, 2017 9:35 pm
Contact:

Mass replace Old URL/Bad Links In Wordpress Post

Post by kachan64 » Tue Apr 09, 2019 11:21 am

If you are working on a test site and you want to deploy your Wordpress website live or simply wanted to change from old link to your new link, you can do so through your hosting's database by using phpMyAdmin.

Use Dead Link Checker to check for dead links on websites.

First, you need to find out the structure of your Wordpress and find where are post stored.

Which is located in wp_post table.
phpmyadmin nav.png
phpmyadmin nav.png (17.01 KiB) Viewed 171 times
The guid column is where pretty much all links for Wordpress posts are stored.
phpmyadmin table.png
phpmyadmin table.png (14.04 KiB) Viewed 171 times
Now, you just have to run a SQL command like below through the SQL tab:

Code: Select all

UPDATE `wp_posts` SET guid = REPLACE(guid, 'https://links.com/', https://newlinks.com/') WHERE `guid` LIKE 'https://links.com/%';
The https://links.com/ part is where your original URL that you wish to change. And where https://newlinks.com/, is where you want the original URL to change it to.

Alternatively you can also use:

Code: Select all

UPDATE `wp_posts` SET `guid` = replace(guid, https://links.com/', 'https://newlinks.com/')
This version is much more simpler and will work for other columns other than the guid column.

Just change wp_posts to any table and guid to any column and you're all set.
Last edited by kachan64 on Tue Apr 09, 2019 12:35 pm, edited 1 time in total.
Reason: Updated information.
Image
PC: Custom Built Gaming PC
Monitor: Samsung S24D390H, Asus VE248H

Post Reply

Return to “Web Design Section”

Who is online

Users browsing this forum: No registered users and 1 guest

Topic Subscribers

1 user subscribed to this topic: kachan64