How to Clean Up Your WordPress File Storage and Make Your Momma Proud

Somewhere between a pristine penthouse and putrid pigsty.

That’s how I’d describe the typical appearance of my room growing up.

I had trophies and trinkets neatly aligned all the time; I made my bed some of the time; and I tossed my worn-but-not-yet-dirty clothes on the bed, floor, or chair pretty much all of the time.

Needless to say, my mother expected more from me, as she should have.

But try as she might, growth in my organization habits seemed to stunt at around eight years old … and they remain pretty much the same today.

Knowing this background, you’ll now not be so shocked by these screenshots of the wp-content and uploads folders of my site MidwestSportsFans.com:

Basically, this is the WordPress equivalent of my childhood bedroom.

Putrid pigsty, indeed.

Some files are in their place, some files are not, and there appears to be a worn undershirt from months ago underneath the bed that no one has bothered to toss in the laundry. (Hmm … but does it pass the sniff test? No! Bad Jerod. You’re 30 now.)

So let’s get personal here for a moment.

I’ve divulged my embarrassing organizational failings. How about you?

  • Did your childhood bedroom embarrass your mother?
  • More importantly, would your WordPress file storage structure embarrass her today?

Chances are your answer is the same to both questions …

If your answer is yes, fear not; the guidance in this post will prove quite helpful.

It’s Time to Clean Up Our (Digital) Rooms

Migrating and performing migration cleanups on a daily basis here at Synthesis, we see a number of WordPress sites that include years worth of static files. This includes images, PDF documents, multimedia files, and much, much more.

Look up at those screenshots from my site again. They provide a nice cross section of what accumulates over time.

In some migrations that we perform, it’s clear that the site owner has a well thought out content organization strategy for the back end of the site. Oftentimes, this means the site owner has used the WordPress media uploader exclusively to let WordPress handle the organization for them.

But more often than not, sites look like mine (see Mom! Everyone else is doing it!) and have files in a variety of places that are the result of plugin functionality or plain old “picking and choosing” when uploading via an FTP client.

Let’s run down some best practices for ensuring a file storage structure that is easy, intuitive, and will create far less pain for you or your managed hosting provider in the future.

Standard WordPress Files Locations

First things first: the fundamentals.

This page of the WordPress Codex shows the proper placement of all standard WordPress files. If this structure ever gets out of whack, your site probably won’t even work.

One way for it to get out of whack is for you to make a mistake moving or deleting files if you’re ever poking around via FTP.

If your site has a bunch of extraneous files floating around, it can be easy to lose sight of what is a core file and what is not.

If you can’t tell this difference, it can lead to the blank white screen of death for you and your visitors.

And if your site is whitescreening, your online business is shut down.

To channel the spirit of the ubiquitous DirecTV ads:

Don’t let your online business be shut down by the white screen of death … get rid of extraneous, unorganized files!

Managing Premium Content

WordPress plugins like Premise, or Download Manager allow you to create premium content and downloads. In many cases, these are put in a different structure than your normal static WordPress files.

The best practice in this case is to use the plugin’s recommended or default settings.

Make sure you research to know where files are being stored, but don’t then try to get fancy and customize it. What is the point?

You don’t want to risk your customizations being overwritten when you update the plugin or having to change strategies down the road.

As they say: keep it simple, stupid.

Multiple Installs

This is where file organization and structure can get the trickiest. It’s also where it’s the most important.

If you have multiple installs of WordPress underneath one domain, as many of you do, you might have individual WordPress file structures at /site1, /site2, /site3, /site4, and so on.

Folks in this boat should consider moving to WordPress multisite.

Remember the importance we placed above on maintaining the proper structure of the core WordPress files? Why manage core files and plugins for multiple sites when you can manage a single instance of WP multisite with a subdirectory installation?

The second option is easier, safer, and just plain better.

It can also be a daunting transition to make. But then again, that’s why you’ve got premium managed hosting in the first place right?

We’re happy to help you out with a multisite transition. (It will actually make you a much easier customer for us to support in the future because of the reduced risk of file catastrophe.)

Content Delivery Networks (CDNs)

But what about CDNs? you ask. Aren’t they the panacea for all my file storage worries? you wonder.

Well, yes and no.

When properly configured to perform specific tasks, CDNs can work wonders. They can be of huge help with speed and performance

However, serving an image from a CDN also means that you have to reconfigure your URL to include a CNAME that points to your CDN provider’s infrastructure. In the eyes of a search engine the URL has changed. This can impact your site’s ability to capture image search.

Of course, you can use 301 redirects and other techniques to re-educate the search engine. However, these can get very difficult if your messy file structure doesn’t provide a clean pattern to serve as a basis for the redirect.

Remember, in SEO it’s all about the URL, and CDNs naturally must serve multimedia from a different URL.

The point is that there are pros and cons. Ask us about how we use CDNs and how we can customize their use to best fit the needs of individual sites.

It’s Time to Make Our Mommas Proud (And Our Sites Safely Organized)

As you can see, being neat and organized is one of those childhood lessons that lasts well into adulthood.

I’m willing to forgive you if your bedroom or desk is messy (let’s be honest, I’d be a hypocrite if I didn’t), but I can no longer sit back and let you introduce risk to your site (and shame to your mother) with a messy, disorganized server file structure.

And I’ve decided to lead by example.

Look at the wp-content and uploads folders of my MidwestSportsFans.com now:

See how much cleaner they are?

And they’d be even cleaner if it didn’t require so much work to go back into post after post and change so many URL references. But these are the challenges wrought over the long haul by an initial faulty file structure strategy.

It’s my time to pay the piper.

Do yourself a favor: start out organized … and stay that way.

If you’re already disorganized like I was, clean it up as much as you can and get organized henceforth.

You never know when mom might pop her head in the door to check.

Comments

  1. I appreciate you writing this, though I’m not sure I got what I was looking for from this article, or maybe it’s better said that I don’t feel I got what the title of the post promised. And whereas I often hit my “back” button and move on in this situation, I’d like to see some discussion of what it really takes to “clean up a messy site”. From the title, I was hoping to find a technique, process or plugin that would help me to solve the messy uploads folder problem on my own sites!

    And while you did a good job defining the problem, and you covered some good advice on why to not let it get messy in the first place, I think you missed on a few opportunities to talk about solutions readers/developers can use now. For example, you talked about CDNs, but didn’t mention the integration features built into W3 Total Cache as a plugin that greatly helps to streamline the use of various CDNs from within a WordPress site. There’s probably a few tools that would help with file management between WP and a CDN, but your section on CDNs was more about SEO than what the post title suggested, “cleaning up file storage”.

    You’re very brave to show folks your screen shots of messy folders! But I think what I would find more valuable is something about a plugin or method that would help developers properly identify media files that are not attached to posts, even though they are in use and shouldn’t be deleted. This is a problem because if you want to prune unused media files from your WP library, you can’t just delete files that show zero posts attached because various plugins and such will not always attach files to posts, and you’d end up missing a bunch of files you actually needed. And from your last paragraphs, it sounds like your solution for clean-up was to manually update file structure and URLs in the db, which is not very practical for many or most sites. Again, from the title of the post, I was expecting to learn one or more killer tips for deleting/cleaning up media files safely and expeditiously, because a manual solution is not very feasible on a site with 1000+ uploaded files.

    Just my thoughts, I hope this prompts for a bit more discussion :) Thanks for the post!

    • Jerod Morris :

      Grant, thanks for reading and for your excellent comment. You are 100% correct that there is far more depth that can be gone into on this post, and you can be sure that we will. Our first handful posts here at the Synthesis blog have been meant as overview type posts, highlighting a few areas we’ve seen discussed often in our help desk and providing some big picture framework-type ways to address them.

      As we move forward, we will be peeling back the onion even further, so to speak, on issues such as these and many more. So you are spot on, and you make some great points, and believe me when I say that we hear you and it’s already in the plans to go where you’ve suggested!

  2. I might be naive here not sure, but I am using a WordPress plugin called “delete-revision” to get rid of all WordPress left overs, it appears to be doing to a good job to me.

    • Jerod Morris :

      I believe this plugin just deletes revisions of posts, but it will not actually clean up your file structure.

      • Yeah, that’s right. There are a lot more that needs to be deleted then just post revisions. However, certainly a part of it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>