WP-CLI
Jump to navigation
Jump to search
Command-line WordPress.
Basics
- https://github.com/wp-cli/wp-cli - based on drush
- tutsplus: Using wp-cli for Fun and Profit - Feb 21st 2012
- http://codeseekah.com/2012/02/23/wordpress-command-line-fun/
Install
git clone --recursive git://github.com/wp-cli/wp-cli.git ~/git/wp-cli cd ~/git/wp-cli sudo utils/dev-build
Usage
wp Usage; wp core [update|help] ... wp home [help] ... wp option [add|update|delete|get|help] ... wp plugin [status|activate|deactivate|install|delete|update|help] ... wp theme [status|details|activate|help] ... wp google-sitemap [build|help] ...
wp --blog=myblog.mynetwork.com set scope to multisite blog
wp core download download latest release wp core update upgrade to latest release wp core version --extra full version infos
wp plugin status display installed plugins wp plugin install hello-dolly install hello-dolly wp plugin install google-sitemap-generator --activate install and activate google-sitemap-generator wp plugin install google-sitemap-generator --activate --dev install and activate google-sitemap-generator development branch wp plugin update akismet update akismet wp plugin update --all update all wp plugin toggle [plugin] turn on/off google-sitemap-generator wp plugin uninstall [plugin] remove plugin from the system wp plugin delete [plugin] delete plugin files
wp theme status main site theme status wp theme status --blog=test.example.com multisite theme status wp theme activate my-new-theme --blog=fooblog.example.com multisite theme activate installed theme cd $(wp theme path twentyeleven) change to theme directory
wp generate posts --count=1000 for testing
wp export --path=./ --user=admin export content to a WXR file wp db dump sql dump wp db query "SELECT MAX(post_date) from wp_posts WHERE post_type = 'post' AND post_status = 'publish'" last post published wp db cli interactive mysql