Reorganize your WordPress files to make your life easier

I really enjoyed my second Denver WordCamp this weekend—it was great to run into faces familiar and new, and learn all kinds of useful information, hear great advice, and more. Might write more up, but a friend pinged me this morning following up on a question, and I thought it would be useful to post.

While chatting in a hallway, the subject of alternative folder setups came up, and a couple of folks were interested in:

  • setting up WordPress in a subfolder, and
  • moving the wp-content folder to a different location

I thought I’d post my current favorite setup for files and configuration.

It starts with the Awesome Config File by Ashfame, based on his answer to a question about keeping your wp-config file in version control. We include more complicated stuff in the main config file, but move login credentials up one level from root so it’s (a) not in a GIT repository and (b) not web-accessible (which may not do much for security really but can’t hurt).

I always go crazy when trying to access the wp-content folder in a file open dialogue, or in Mac’s Finder, because it’s in the middle of a long list of files in WordPress. I use my keyboard for quick navigation of folders, and with the default WordPress install, I have to type “wp-cont” before I can get to that folder. When you access that folder again and again, those 7 characters add up. So getting the folder OUT of the WordPress install is great.

My setup kind of looks like this:

root/
  .htaccess
  index.php — copy of WP default index.php, but needs to be tweaked slightly
  site-content/ — this is my replacement for wp-content
  wp/ — default WP install goes here
  wp-config.php
config-folder/
  local-config.php — includes credentials for local site, omitted on production site
  production-config.php — includes credentials for production site

This setup has made it super-easy for me to access site files quickly while working on them, it keeps the default WP install easy to replace, and it lets the whole thing be in a GIT repo if I want. There are other issues there, may touch on them sometime. But that’s what I know for now.

Download a sample file structure & wp-config file here.

Hey Lisa, hope this is useful!

Leave a comment

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