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 have a heap of images inside MovableType, on an old server. There are plenty which have character entities like %20 to represent spaces.

I've used some plugins to import the images and change the URLs inside posts, but while MT can deal with /my%20dog.jpg, WP just shows a 404.

Assuming there's no way to get WP to display these images, and I have to rename them, what's the best way to:

  • Rename all the files (strip out character entities)
  • Rename all the URLs referenced in posts

I'm a little bit stuck here and not sure what the best way of solving this would be, whether via SSH and SQL queries, or otherwise.

share|improve this question

You are going to need:

1. Total Commander (or anything else that allows you to rename massive numbers of files)

Probably the best file manager in the world (especially when it comes to handle uploads etc.), it's not free but the trial version should do the job. Just select all these images (they could be anywhere within Total Commander and choose "Multi-Rename tool (CTRL+M)" from "File" Menu.

In "Search for" field type: %20 then change it to anything you like within "Replace with" field (I guess the best choice would be: _).

Get Total Commander from: http://www.ghisler.com/

2. A simple SQL command.

UPDATE wp_posts SET post_content = replace(post_content,"%20","_");

It just "scans" every post for %20 and then simply replaces it with _

I hope it helps.

share|improve this answer
Thanks - I'll give that a go and see if it helps! Wish this could be done with htaccess/server side, though. – Jon Lay Nov 6 '11 at 13:16

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.