Friday , December 20 2024

How to recursively replace a domain, word, or phrase in a database

I describe this task using the example of a transferred WordPress site to another folder of another domain.

To implement it, you need to search the database by domain name, you will see in which tables there are records with this domain. Then make a SQL query in the format:

UPDATE wp_posts SET post_content = REPLACE(post_content, 'olddomainname.com', 'newdomainname.com/folder');
wp_posts – table name
post_content – field in this table
olddomainname.com – old value to replace
newdomainname.com/folder – new value

About admin

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

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