Skip to content

Instantly share code, notes, and snippets.

@davilera
Last active January 4, 2019 15:42
Show Gist options
  • Save davilera/6aaa18745576d5c6d7dc30ba9edb03f2 to your computer and use it in GitHub Desktop.
Save davilera/6aaa18745576d5c6d7dc30ba9edb03f2 to your computer and use it in GitHub Desktop.
WP-CLI Introduction

Introduction to WP-CLI at Nelio Software.

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info
cd ~/dev/wordpress/
...
wordpress:
depends_on:
- mysql
image: wordpress
...
...
wordpress:
depends_on:
- mysql
image: conetix/wordpress-with-wp-cli
...
docker-compose exec SERVICE_NAME COMMAND [OPTIONS...]
docker-compose exec wordpress wp --info
alias wp="docker-compose exec wordpress wp"
wp <command> <subcommand> --<option-with-value>=<option-value> --<option-without-value>
wp core install \
--url=content.local --title="Nelio Content" \
--admin_user=admin --admin_password=password --admin_email=admin@content.local
wp core update --version=4.9.6 --force
+---------------+----------+-----------+---------+
| name | status | update | version |
+---------------+----------+-----------+---------+
| akismet | inactive | available | 4.0.8 |
| hello | inactive | none | 1.7 |
| nelio-content | inactive | none | 1.6.7 |
+---------------+----------+-----------+---------+
wp plugin delete akismet hello
wp plugin activate nelio-content
wp plugin install nelio-ab-testing --activate
+-----------------+----------+-----------+---------+
| name | status | update | version |
+-----------------+----------+-----------+---------+
| twentyfifteen | inactive | available | 2.0 |
| twentynineteen | inactive | none | 1.1 |
| twentyseventeen | active | available | 1.7 |
| twentysixteen | inactive | available | 1.5 |
+-----------------+----------+-----------+---------+
wp theme activate twentynineteen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment