Support » Fixing WordPress » Moving WP site to new domain – media URLs not working

  • I ran into this issue after moving a WP site to a new domain. I built the WP site on an internal staging domain–say, Once it was ready, I moved it to it’s live domain (say,

    Besides issues around logging in (which I worked around), I went to the admin page and any setting that was still referencing I changed to

    However, I noticed that the media URLs were broken (still referencing the domain). After some digging, I realized that posts store the full resolved URL in posts.post_content in the DB. I also noticed that a few plugins also follow this pattern and store settings with the full resolved URL in options.option_value.

    To work around this I had to run the following MySQL update commands:

    update posts set post_content = replace(post_content, "", "");

    update options set option_value = replace(option_value, "", "");

    I’m not sure if there is a smarter way of doing this (I assumed setting the site URL in the admin panel would “Just Work”(TM))… apparently not.

    Perhaps there’s a potential for a new WP feature or plugin that could provide a one-button (set my site URL to this) and handle all of this automatically.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Moving WP site to new domain – media URLs not working’ is closed to new replies.