WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Mass editing images in posts (2 posts)

  1. bpetruzzo
    Member
    Posted 4 years ago #

    I searched the forum and google, but didn't find anything.

    I have a blog with nearly 700 posts. Many of them have images. I recently switched domain names. The images, naturally, are all broken now. I'm looking for a way to automatically change all images to the new domain name.

    So, for example, right now, the images are:

    http://my.domain.com/image.jpg

    I need it to be:

    http://www.mydomain.com/image.jpg

    If I switch it manually it works. So I just need a simpler way of making those switches. I thought there might be some kind of a mass MySQL editing tool that could find every instance of the old domain and replace it with the new one. Similar to how you might do it in a word processor.

    Any ideas?

  2. bpetruzzo
    Member
    Posted 4 years ago #

    Okay, I don't know why I didn't think of this before. I solved my problem.

    1. I downloaded my wordpress database and saved it as a backup.

    2. I copied the backup to another location and opened it in a text editor (text wrangler in my case).

    3. I searched for the old domain name, then used the 'replace all' command to replace it with the new domain name. It found several thousand instances of the old domain and replaced them all.

    4. In PHPmyAdmin, I dropped all the tables then imported my modified database file. All of my links were fixed.

Topic Closed

This topic has been closed to new replies.

About this Topic