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.

1 Answer 1


You can do an untrailingslashit() also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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