WP-CLI

WP-CLI é um programa para administrar o WordPress através de um terminal shell (coisa de nerd ou hacker). O programa é um conjunto de linhas de comando para gerenciar instalações WordPress, como ele pode-se atualizar plugins, configurar instalações multisite e muitas ações via linha de comando, sem utilizar um navegador web.

O objetivo da WP-CLI é fornecer uma interface em linha de comando para qualquer ação que se queira executar na administração do WordPress. Por exemplo o comando wp plugin install --activate permite a instação e ativação de um plugin WordPress, veja abaixo:

$ wp plugin install rest-api –activate Installing WordPress REST API (Version 2) (2.0-beta13) Downloading install package from https://downloads.wordpress.org/plugin/rest-api.2.0-beta13.zip… Unpacking the package… Installing the plugin… Plugin installed successfully. Activating ‘rest-api’… Success: Plugin ‘rest-api’ activated.

Aqui uma lista de comandos

 

A lista a seguir será exibida:

Command Description
   
cache Manage the object cache.
cap Manage user capabilities.
cli Get information about WP-CLI itself.
comment Manage comments.
core Download, install, update and otherwise manage WordPress proper.
cron Manage WP-Cron events and schedules.
db Perform basic database operations.
eval Execute arbitrary PHP code after loading WordPress.
eval-file Load and execute a PHP file after loading WordPress.
export Export content to a WXR file.
help Get help on a certain command.
import Import content from a WXR file.
media Manage attachments.
menu List, create, assign, and delete menus
network  
option Manage options.
plugin Manage plugins.
post Manage posts.
rewrite Manage rewrite rules.
role Manage user roles.
scaffold Generate code for post types, taxonomies, etc.
search-replace Search/replace strings in the database.
shell Interactive PHP console.
sidebar Manage sidebars.
site Perform site-wide operations.
super-admin List, add, and remove super admins from a network.
term Manage terms.
theme Manage themes.
transient Manage transients.
user Manage users.
widget Manage sidebar widgets.

Execute o comando wp --info para ver as principais informações do wp-cli:

$ wp –info PHP binary: /usr/bin/php5 PHP version: 5.5.9-1ubuntu4.14 php.ini used: /etc/php5/cli/php.ini WP-CLI root dir: /home/wp-cli/.wp-cli WP-CLI packages dir: /home/wp-cli/.wp-cli/packages/ WP-CLI global config: /home/wp-cli/.wp-cli/config.yml WP-CLI project config: WP-CLI version: 0.23.0

Para instalar e ativar plugins é muito fácil, e você vai começar a ver que os comandos são bem intuitivos, digite a seguinte sintaxe:

wp plugin install Plugin_Name wp plugin activate Plugin_Name

Leia mais no guia rápido oficial (Quick Start WP-CLI)