wp cli
Upcoming SlideShare
Loading in...5
×
 

wp cli

on

  • 140 views

wp-cli

wp-cli

Statistics

Views

Total Views
140
Views on SlideShare
138
Embed Views
2

Actions

Likes
4
Downloads
1
Comments
0

1 Embed 2

https://twitter.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

wp cli Presentation Transcript

  • 1. ./WP-CLI 2014.10.18 - wokamoto
  • 2. http://wp-cli.org
  • 3. Features WordPress に関するあらゆる操作がコマン ドラインから実行できる つまり、インストールやアップデートなんか の作業をスクリプトで自動化できる!
  • 4. Requirements UNIX-like environment (OS X, Linux, FreeBSD, Cygwin) PHP 5.3.2 or later WordPress 3.5.2 or later
  • 5. Install $ curl -O https://raw.githubusercontent.com/wp-cli/ builds/gh-pages/phar/wp-cli.phar $ mv wp-cli.phar wp $ chmod +x wp
  • 6. Install Vagrant での WordPress環境 vccw や Amimoto AMI にはインストール済みです。 ! Amimoto AMI(Amazon Machine Image) -> http://amimoto-ami.com
  • 7. WordPress Install $ wp core download $ wp core config --dbname=<dbname> --dbuser=<dbuser> --dbpass=<dbpass> $ wp db create $ wp core install --url=<url> --title=<site-title> --admin_user=<username> --admin_password=<password> --admin_email=<email>
  • 8. Plugin Install $ wp plugin install <plugin_name> $ wp plugin activate <plugin_name> $ wp plugin status $ wp plugin deactivate <plugin_name>
  • 9. Theme Install $ wp theme install <theme_name> $ wp theme activate <theme_name> $ wp theme status $ wp theme deactivate <theme_name>
  • 10. WordPress Update $ wp core update $ wp core update-db $ wp plugin update --all $ wp theme update --all
  • 11. Export $ wp export $ wp export --max_file_size=<MB> $ wp export --start_date=<date> --end_date=<date> $ wp export --post_type=<post-type> $ wp export --category=<name> $ wp export --post_status=<status> $ wp export --skip_comments
  • 12. Import $ wp import <file_name.xml> --authors=<authors> [--skip=<data-type>] ! authors ・create ・mapping.csv ・skip
  • 13. DB Export, Import… $ wp db export $ wp db import <dump_file.sql> $ wp db reset $ wp db tables $ wp db query <sql> $ wp db repair $ wp db optimize
  • 14. Search and Replace $ wp search-replace <old> <new> [<table>…] ! [example] $ wp search-replace http://localhost http://example.com
  • 15. Execute PHP code $ wp eval <php-code> ! [example] $ wp eval "echo home_url();"
  • 16. Manage Users $ wp user list $ wp user create <user-login> <user-email> --role=<role> --user_pass=<password> $ wp user update <user> --<field>=<value> $ wp user delete <user>
  • 17. Manage Posts $ wp post list $ wp post url <id> $ wp post delete <id> $ wp post get <id> $ wp post meta <add|delete|get|list|update> <id> [val] [example] $ wp post meta set 123 _wp_page_template hoge.php
  • 18. Add Post $ wp post create [<file>] [--<field>=<value>] ! [example] $ wp post create --post_title='A future post' --post_status=future —post_date='2020-12-01 07:00:00' $ wp post create ./post-content.txt --post_category=201,345 --post_title='Post from file'
  • 19. Media $ wp media regenerate --yes $ wp media import <file> [example] $ wp media import ~/Downloads/image.png $ wp media import ~/Pictures/*.jpg $ wp media import http://example.com/style/image.png
  • 20. Manage Options $ wp option <add|delete|get|update> <key> [val] ! [example] $ wp option get site_url $ wp option add my_option hoge $ wp option update my_option '{"hoge":"piyo"}' --format=json $ wp option delete my_option