WordPress: Everyday use of WP-CLI (command line interface)

WP-CLI is a nifty tool to use when you use WordPress A LOT. I manage many different single and multisite installs so WP-CLI saves me tons of time AND makes me feel cool. Here’s some tips:

Commands I often use:

Update all plugins/themes w/ update available
wp plugin update --all
wp theme update --all

Search for and Install a plugin (ex: google fonts)
wp plugin search google
OUTPUT:
Success: Showing 10 of 3622 plugins.
+--------------------------------+-----------------------+--------+
| name | slug | rating |
+--------------------------------+-----------------------+--------+
| The Google+ plugin | google | 85.6 |
| Google Maps Ready! | google-maps-ready | 77.8 |
| Google Publisher Plugin (beta) | google-publisher | 72.4 |
| SZ - Google for WordPress | sz-google | 95.6 |
| Google Drive Embedder | google-drive-embedder | 100 |
| WordPress Google Form | wpgform | 98.6 |
| Pronamic Google Maps | pronamic-google-maps | 85.2 |
| Google Analyticator | google-analyticator | 73.8 |
| Google Apps Login | google-apps-login | 100 |
| Google Ads Master | google-ads-master | 76.4 |
+--------------------------------+-----------------------+--------+

Uh oh, I can’t find google fonts on this list and unfortunately don’t know the slug but want to find it w/ having to use the browser. I’ll do this:

wp plugin search google --per-page=100 | grep 'fonts'

I am searching the WordPress repo for the first 100 plugins w/ name, slug, or author containing ‘google’ and then running a grep on those results to return only those that contain the word ‘fonts’.

OUTUPUT:
Easy Google Fonts easy-google-fonts 96.6
Google Webfonts For Woo Framework google-fonts-for-woo-framework 100
WP Google Fonts wp-google-fonts 88.2
Google Fonts For WordPress free-google-fonts 100
Google Web Fonts Manager google-web-fonts-manager-plugin 63.4

There it is! Now I have the slug, time to install and activate:

wp plugin install wp-google-fonts --activate

Installing wordpress

wp core download
Edit wp-config-sample.php
Add database credentials
Save as wp-config.php
wp core install

W/ a little help from my friend, GREP:

Get list of themes with available updates:
wp theme list | grep available
or
?wp theme status | grep U?
Get list of plugins with available updates:
wp plugin list | grep available
or
wp plugin status --all | grep U

×

Comments are closed.