WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I moved from Wordpress.com to my own Wordpress.org hosting. I had no problems importing all my posts over, and the images were all linked up fine.

Since the import, I decided to move my WP install from the root of HTML_public, to a new folder called Wordpress.

The posts are all still fine, but the picture links are still pointing to:

When they should be pointing to:

I am assuming I must have missed out a step and should have not been so hasty in moving things around.

Is there an easy way to automatically update all pics in all posts to point to the new URLs? i.e. Add the new wordpress folder into each of the link URLs


share|improve this question
Well, the way I would do this would be to throw the latest version of phpMyAdmin on your server and export a copy of your database. Then use a text editor like Coda, Smultron, or Notepad++ to edit that file and run a find/replace on the URL. I'd love to answer this more completely now but I'm not on a computer that has programs for me to author up some screenshots. I'll be able to provide a more complete answer soon. – Drew Gourley Apr 14 '11 at 4:21
up vote 3 down vote accepted

Search RegEx is a good plugin to be able to search and replace with Grep through all posts and pages to fix things like broken URLs.

And no need to export the DB and use a text editor; that's overkill for simply adding the /wordpress.

share|improve this answer
Oh I like this a lot! – Drew Gourley Apr 14 '11 at 4:46
Worked for me. Very dangerous in the wrong hands though. Thanks – Simon Apr 15 '11 at 3:29

Also, you can apply on your database something like:

update wp_posts 
set post_content = 
replace(post_content, 'site.test.net/old_folder', 'site.test.net/new_folder' );

of course use carefully.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.