Skip to content

Instantly share code, notes, and snippets.

@ashikawa
Last active October 29, 2018 12:07
Show Gist options
  • Save ashikawa/5772324 to your computer and use it in GitHub Desktop.
Save ashikawa/5772324 to your computer and use it in GitHub Desktop.
wp-cli sample
# db export
wp db export ../wp_db.sql
# update all
wp core update && wp core update-db && wp plugin update-all && wp theme update --all
# list all plugins
wp plugin list --format=csv | \
fgrep -v inactive | \
fgrep active | \
awk -F"," '{ print "wp plugin install " $1 " --activate" }'
# Custom Field Template
wp plugin install custom-field-template --activate
# Google XML Sitemaps
wp plugin install google-sitemap-generator --activate
# PS Disable Auto Formatting
wp plugin install ps-disable-auto-formatting --activate
# TinyMCE Advanced
wp plugin install tinymce-advanced --activate
# TinyMCE Templates
wp plugin install tinymce-templates --activate
# WP Multibyte Patch
wp plugin install wp-multibyte-patch --activate
# Image Widget
wp plugin install image-widget --activate
# Featured Post
wp plugin install featured-post --activate
# Post-Plugin Library
wp plugin install post-plugin-library --activate
# Popular Posts
wp plugin install popular-posts-plugin --activate
# Similar Posts
wp plugin install similar-posts --activate
#!/bin/sh
# WP-CLI Template
# @see http://wp-cli.org/
# install
sudo wget https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp
sudo chmod +x /usr/bin/wp
cd $WP_ROOT
wp core download --locale=ja
# set DB & Install
wp core config \
--dbhost=$DBHOST \
--dbname=$DBNAME \
--dbuser=$DBUSER \
--dbpass=$DBPASS
wp core install \
--url=$SITE_DOMAIN \
--title=$SITE_TITLE \
--admin_name=$ADMIN_NAME \
--admin_email=admin@example.com \
--admin_password=password
chown -R apache:apache *
chmod -R g+w *
# wp-config.php
cat << EOT > wp-config.php
define('FS_METHOD', 'direct');
define('FS_CHMOD_DIR', 0775);
define('FS_CHMOD_FILE', 0664);
// 自動更新を止める
// define('AUTOMATIC_UPDATER_DISABLED', true);
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment