Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

You can do an untrailingslashit() also.

share|improve this answer
add comment

Your Answer

 
discard

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.