DEV Community

Discussion on: The Ultimate Guide to Local WordPress Development on a Mac

Collapse
 
traaidmark profile image
Adrian Kirsten

I am by no means a pro-level wordpress dev, but I do a fair amount of work on the platform.

If you'll allow me, some thoughts on your article here:

I generally work with $jsframework which means I rarely need a proper server setup on my local machine, but I did follow Chris's guide too for the times I do need one, and it works great, right up to the point where I want to access $site from my phone over the wifi network. For some reason that xip.io thing just refuses to work. eh.

At first when I read that you only add your theme to a repo I found it quite strange, but the more I thought about it, it makes a lot of sense. My experience with Wordpress, especially moving it around is not a great one, and now I think of it, most of that negativity comes with moving the entire wordpress platform from local to staging to production, and not just the theme.

And it makes sense. Wordpress itself doesn't change much.

If I can add something to your guide to make it the SUPER ULTIMATE GUIDE TO LOCAL WORDPRESS DEVELOPMENT (with uppercase and all!):

I realise you don't enjoy working in the terminal much, but... and here me out on this one, it will literally change your life: Add WP CLI to your toolbox.

Once you've gotten that working you're ready to start really cooking. Download a copy of WordPress, unzip it, and drop it into ~/Sites/wordpress/ first. You're going to run into some permission issues probably, but you can handle them with:

Or:

  • $ cd ~/Sites/wordpress/ to get you in your working folder
  • $ wp core download - Downloads the latest wp to that folder
  • $ wp core config --dbname="wp-experiment" --dbuser="whatevs" --dbpass="shhh" --dbhost="127.0.0.1" --skip-check - creates your wp-config.php file for you.
  • $ wp db create - creates the db for you using the deets you entered into your wp-config.php file.
  • $ wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com - does the wp install in seconds.

You now have a running wordpress site! The cooler thing about the wp cli is that your average maintenance becomes a lot quicker.

  • $ wp core update - updates your wordpress installation
  • $ wp plugin update - updates all your plugins
  • $ wp plugin install bbpress --activate - install & activate a plugin

There is obvs a whole lot more it can do, especially around migrating content/db between servers etc.

You could for example create a very simple bash script that runs some of these commands for you to move all your uploads to another server, migrate the content/db, change urls etc for you.