Upload
ryanduff
View
654
Download
2
Embed Size (px)
DESCRIPTION
Extending your WordPress Toolbelt with WP-CLI presentation from WordCamp Austin 2014. March 27, 2014.
Citation preview
Extending Your WordPress Toolbelt
with WP-CLI
WordCamp Austin 2014 Ryan Duff
# whoami
• WordPress Developer
• Open Source Contributor
• Sysadmin (sort of)
What is WP-CLI?
WP-CLI is a set of command-line tools for managing WordPress installations.
WP-CLI is a set of command-line tools for managing WordPress installations.
So Let’s Get Started
Requirements
• UNIX-like environment (OS X, Linux, FreeBSD, Cygwin)
• PHP 5.3.2 or later
• WordPress 3.5.2 or later
!
• Basic knowledge of the command line
What Does It Do?
What Does It Do?Everything... almost
!
!
!
!
!
What Does It Do?Everything... almost
!
!
!
!
Sorry… it won’t make you coffee.
Top Level Commands
Download, Configure, Install
wp core download!!
!!
wp core config !! --dbname=wcatx !! --dbuser=wcatx !! --dbpass=wcatx!
!
wp core install !! --url=“http://wcatx.dev” !! --title="Site Name" !! --admin_user=notadmin !! --admin_password=somethingstrong !! --admin_email="[email protected]"
wp option update timezone_string “America/New_York"!!wp rewrite structure ‘/%year%/%monthnum%/%postname%/‘ --hard
Install and Manage Plugins
Install and Manage Themes
Import / Export
wp import!!wp export
Managing the Database
wp db export!wp db import!!!wp db cli!!!wp site empty
Search and Replace
wp search-replace!!wp search-replace “oldsite.dev” “newsite.com”!!!--network!--dry-run
Posts
Comments
Media
wp media regenerate --yes
Users Roles
Capabilities
Multisite Rewrites Options
Terms Menus
Sidebars Widgets
Plugin or Theme developer?
English please?
Community Commands
Dictator
Dictator
Your Own Commands
How to Install
The Quick Lazy Easy Way™
# mkdir -p ~/.wp-cli/bin !!# cd ~/.wp-cli!!# curl -L https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > bin/wp!!# chmod +x bin/wp!!!# curl -LO https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash
Almost ready…
Add to ~/.bash_profile, .zshrc, etc !
# add to $PATH export PATH=$HOME/.wp-cli/bin:$PATH !
# autocomplete source $HOME/.wp-cli/wp-completion.bash
Using ZSH?
# autocomplete autoload bashcompinit bashcompinit source $HOME/.wp-cli/wp-completion.bash
MAMP or other custom PHP
export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
Installing the Better Way™
(so you can contribute, of course)
# git clone [email protected]:ryanduff/wp-cli.git ~/.wp-cli!!# cd wp-cli!!# git remote add upstream [email protected]:wp-cli/wp-cli.git!!# composer install
Almost ready…
Add to ~/.bash_profile, .zshrc, etc !
# add to $PATH export PATH=$HOME/.wp-cli/wp-cli/bin:$PATH !
# autocomplete source $HOME/.wp-cli/wp-cli/utils/wp-completion.bash
More InfoWeb: http://wp-cli.org/ !
Core Commands: http://wp-cli.org/commands/ !
Cookbook: https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook !
Github: https://github.com/wp-cli/wp-cli
Contributing
https://github.com/wp-cli/wp-cli/blob/master/CONTRIBUTING.md
!
https://help.github.com/articles/fork-a-repo
Questions?
Ryan Duff !
!
email: [email protected] !
web: http://fusionized.com !
twitter: @ryancduff !
github: https://github.com/ryanduff