WordPress and Rails

Most of my day is spent coding Rails apps, but most of them these days also have a WordPress component to them. This means I sometimes need to set up a local WordPress site that can communicate with my local Rails apps. I’ve tried various approaches over the years like setting up full blown Nginx locally to serve both my Rails and PHP apps. I’ve also tried tools like MAMP and Local. My new favorite approach though is to simply serve WordPress over Pow, which I already use for all of my local Rails development.

Quick side note on Local

If all you need is a quick way to spin up a WordPress site that doesn’t need to communicate with anything else on your host machine, Local is a fantastic tool. It has a very clean interface and sets up WordPress sites in an isolated way using virtual machines under the hood.

WordPress and Rails

The meat of getting this set up can be found in this great article by Per Søderlind about WordPress and Pow. It is an old article (2012), but it still works great on my brand new iMac with macOS Sierra.

The only change I made was that I used the excellent WP-CLI to download and install WP. Here is briefly how I used that.

Now I can happily continue using WordPress and Rails together using consistent URL formats without bothering to install other external tools. Best of all, its scriptable making it easy to set this back up on machine rebuilds.

Happy Railspressing!