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

Wordpress is automatically adding a trailing slash to my custom upload folder in Settings » Media. This is causing upload URLs (for example, for images uploaded through the Media Uploader) to get a double slash, as in example.com/files//myfile.jpg

Here's what happens:

  1. I go to Settings » Media

  2. Under Uploading Files in the field labeled Store uploads in this folder, I type in files, with no trailing slash. (This is consistent with the example listed next to the text field: Default is wp-content/uploads)

  3. Hit "Save Changes"

  4. The page reloads, and the upload folder is now files/, with a trailing slash.

I have tested other URLs (files/myfiles, uploads), and Wordpress always adds a trailing slash when I hit save. I have Organize my uploads into month- and year-based folders unchecked.

What gives? How do I fix this?

I am on 3.3.1, but this was happening in 3.2 as well.

share|improve this question

You can do an untrailingslashit() also.

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.