9. WHY USE COMMANDS?
•Quickly execute a task
•Bundle many tasks together in scripts
•Avoid using the keyboard and mouse
•Simplify repetitive tasks
•and also…
12. WHAT DO I NEED TO GET STARTED?
•Local Dev Environment with PHP - VVV, MAMP, WAMP
•Terminal - Terminal App, iTerm 2, PuTTY
•Text Editor - Sublime, Atom
PREREQUISITES
19. WHAT HAVE I DONE?
• Installed WP-CLI locally
• Configured a WP-CLI alias to SSH into remotes
• I can execute remote commands as if they were on my local
machine
• No need for local MySQL
• Alternate - use SSH directly into VVV
20. CONFIGURATION
•Alias called @dev allows me to run remote commands
• $wp @dev cli info is different than $wp cli info
• @dev connects via SSH and runs on Vagrant box
https://make.wordpress.org/cli/handbook/config/
wp-cli.yml - Aliases with Vagrant
23. CONFIGURATION
•Allows you to configure WP-CLI variables
•File can be at the Global, Project and Local levels
•e.g.: Local overrides Global
•Allows you to set up Aliases per site
https://make.wordpress.org/cli/handbook/config/
wp-cli.yml
31. INSTALL WORDPRESS
# Create Database for install
$wp db create wpcli-test
# Run the install process
$wp core install
—url=wpcli-test.dev —-title=“wpcli test”
—admin_user=admin --admin_password=password
--admin_email=info@example.com
32. INSTALL WORDPRESS
•Not needed if you’re using VVV
•WP installs can be created and provisioned via Vagrant
Note for VVV Users
https://varyingvagrantvagrants.org/
34. SHELL SCRIPTING
•You can use WP CLI with like any other command
•e.g. tie commands together and run them as a list
35. INSTALL WORDPRESS PLUGINS, THEME
#!/bin/bash
# list of plugins
plugins=("user-switching" "debug-objects""wp-cfm")
# loop through plugin list and install
for plugin in ${plugins[*]};
do
wp plugin install $plugin
wp plugin activate $plugin
done