How I setup WordPress for Development – Part 1




Screencasts – WP Theme Tutorial show

Summary: Every site I deal with has some initial setup to deal with. First off I don’t want to email site users by accident from staging or local enivornments. Second I want to be able to log a bunch of data in the system like password resets…Third I want to be able to change configurations based on my environment. An example of the third item would be restricting access to the site on the staging server, but not on live/local. I don’t want to go in and make admin changes if at all possible so I automate it all via code. Today we’re going to look at how I deal with email logging and my starting setup for site environments. Developer Constants To start we need an mu-plugins folder in our wp-content folder. If you’re not familiar with mu-plugins, it’s a special folder that runs before all other plugins and it’s a MUST USE. So any code in there is always activated and running. Now in to our mu-plugins folder we need to add our <a href="https://github.com/curtismchale/WPTT-Developer-Constants">Developer Constants</a> plugin to start defining our environments. Place it in a folder called wptt-developer-constants. So our files should look like: wp-content mu-plugins wptt-developer-constants/wptt-developer-constants.php A quirk of the mu-plugins folder is that it won’t execute code inside folders. That means we need to add a bootstrap file at the base level to include all of our included plugins. Go ahead and create a file called wptt-bootstrap.php inside the mu-plugins folder and put the code below inside it.