Last active
August 29, 2016 20:49
-
-
Save zanematthew/f003f725f251ecbda245bd1627b103f0 to your computer and use it in GitHub Desktop.
Useful WP CLI commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### | |
# Useful WP CLI commands | |
# | |
# All are presumed to be ran from the location of the `wp-config` file in | |
# question. | |
# | |
# Add an admin user | |
$ wp user create some-user-name [email protected] --role=administrator | |
# Add a superadmin for WP Networking | |
$ wp user create some-user-name [email protected] --role=superadmin | |
# Search for a value, and replace it, but do not execute on the database | |
$ wp search-replace 'foo.com' 'foo.dev' wp_options --dry-run | |
+------------+--------------+--------------+------+ | |
| Table | Column | Replacements | Type | | |
+------------+--------------+--------------+------+ | |
| wp_options | option_name | 0 | SQL | | |
| wp_options | option_value | 7 | PHP | | |
| wp_options | autoload | 0 | SQL | | |
+------------+--------------+--------------+------+ | |
Success: 7 replacements to be made. | |
# Search for a value, and replace it, but do execute it on the database | |
$ wp search-replace 'foo.com' 'foo.com.dev' wp_option | |
+------------+--------------+--------------+------+ | |
| Table | Column | Replacements | Type | | |
+------------+--------------+--------------+------+ | |
| wp_options | option_name | 0 | SQL | | |
| wp_options | option_value | 7 | PHP | | |
| wp_options | autoload | 0 | SQL | | |
+------------+--------------+--------------+------+ | |
Success: Made 7 replacements. | |
# Activate plugin | |
$ wp plugin activate some-plugin | |
# Deactivate plugins | |
$ wp plugin deactivate some-plugin | |
# List active plugins | |
$ wp plugin list | |
+----------------------------------------------+----------+-----------+---------+ | |
| name | status | update | version | | |
+----------------------------------------------+----------+-----------+---------+ | |
| plugin-a | active | none | 0.1.2 | | |
| some-other-plugin | active | available | 2.1.7 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment