Skip to content

Instantly share code, notes, and snippets.

@scottlee
Last active January 15, 2016 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottlee/cfdbfa2a8ace221ca4ec to your computer and use it in GitHub Desktop.
Save scottlee/cfdbfa2a8ace221ca4ec to your computer and use it in GitHub Desktop.
A list of common WP-CLI commands.

Export/Import db

wp db export nameoffile.sql wp db import nameoffile.sql

Export WXR

wp export --dir=../wxr-exports --url=example.com wp export --dir=~/wxr-exports --url=example.com --start_date=2015-08-01 --end_date=2015-09-18

Using Bash

for f in ~/path-to-xmls/*.xml; do wp import $f --url=example.com --authors=create; done

List Users

wp user list

Create User

wp user create john.doe j.doe@example.com --role=administrator --user_pass=super_secure_password wp super-admin add ID

wp --url=example.com user create username email --user_pass=password --role=administrator"

Change User Password

wp user update 1 --user_pass=Ch@ngeme

Search & Replace (Find and Replace)

wp search-replace 'http://example.com' 'http://example.dev'

Regenerate thumbnails using wpcli

wp media regenerate --url=example.com

Deactivate all plugins

wp plugin deactivate —all

Get Site URL

wp option get siteurl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment