WP-CLI

¿En qué podemos ayudarte?
< Regresar
Estás aquí:
Imprimir

Instalación

#curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

#chmod +x wp-cli.phar

#sudo mv wp-cli.phar /usr/local/bin/wp

Probando la instalación

#wpinfo

Sintaxis

wp menu          List, create, assign, and delete menus.

wp option         Manage options.

wp plugin         Manage plugins.

wp post            Manage posts

wp post-type    Manage post types.

wp role             Manage user roles

wp search-replace     Search/replace strings in the database.

wp server                   Launch PHP’s built-in web server for this specific WordPress install.

wp sidebar        Manage sidebars

wp site              Perform site-wide operations

wp super-admin         Manage super admins on WordPress multisite

wp taxonomy     Manage taxonomies.

wp term               Manage terms

wp theme            Manage themes

wp transient        Manage transients

wp user               Manage users.

wp widget           Manage sidebar widgets.

Tutorial

Ayuda

# wp help

Instala entidad de wordpress

# wp core download

Configura base de datos

# wp core config –dbname=mydbname –dbuser=mydbuser –dbpass=mydbpass –dbhost=localhost –dbprefix=whebfubwef_ –extra-php

Configura archivo wp-config.php 

# wp core install –url=http://website.com –title=WP CLI Website –admin_user=username –admin_password=password –admin_email=email@website.com

Actualiza wordpress

# wp core update

Regresa a una version anterior de wordpress

# wp core updateversion=4.5.4force

Instala y activa plugins

# wp plugin install user-switching –activate

Instala y activa multiples plugins

# wp plugin install wordpress-seo elementor –activate

desactiva todos los plugins

# wp plugin deactivate –all

Actualiza uno o todos los plugins

# wp plugin update wordpressseo

# wp plugin update –all

Instala y activa temas

# wp theme install twentynineteen

# wp theme activate twentynineteen

# wp theme install twentynineteen –activate

Muestra y busca temas en el repositorio

# wp theme list

 

# wp theme search <search string>

 

Crea y edita post

# wp post createpost_title=‘My first post using CLI’

 

# wp post edit 243

 

Busca y Reemplaza

# wp search-replace {old URL} {new URL} –dry-run –activate

# wp search-replace ‘https://oldURL’ ‘https://newURL –dry-run –activate

Migracio de contenido

# wp db exporthelp

wp db export

DESCRIPTION

Exports the database to a file or to STDOUT.

SYNOPSIS

wp db export [] [–dbuser=] [–dbpass=] [–=] [–tables=] [–exclude_tables=] [–porcelain]

ALIAS

dump

Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
`DB_PASSWORD` database credentials specified in wp-config.php.

OPTIONS

[]
The name of the SQL file to export. If ‘-‘, then outputs to STDOUT. If
omitted, it will be ‘{dbname}-{Y-m-d}-{random-hash}.sql’.

[–dbuser=]
Username to pass to mysqldump. Defaults to DB_USER.

[–dbpass=]
Password to pass to mysqldump. Defaults to DB_PASSWORD.

[–=]
Extra arguments to pass to mysqldump.

[–tables=]
The comma separated list of specific tables to export. Excluding this parameter will export all tables in the database.

[–exclude_tables=]
The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.

[–porcelain]
Output filename for the exported database.

EXAMPLES

# Export database with drop query included
$ wp db export –add-drop-table
Success: Exported to ‘wordpress_dbase-db72bb5.sql’.

# Export certain tables
$ wp db export –tables=wp_options,wp_users
Success: Exported to ‘wordpress_dbase-db72bb5.sql’.

# Export all tables matching a wildcard
$ wp db export –tables=$(wp db tables ‘wp_user*’ –format=csv)
Success: Exported to ‘wordpress_dbase-db72bb5.sql’.

Administrando usuarios

# wp user list

# wp user create John john@yourwebsite.com –role=administrator

# wp user update john –display_name=John –user_pass=john123pass

Borra un usuario y reasigna sus posts a otro usuario

# wp user delete john –reassign=bob

Actualiza passwd

# wp user update USERNAME –user_pass=”NEW_PASSWORD”

Administrando multisitios

#wp site create –slug=demo2

Success: Site created: www.mywebsite.com/demo2/

Lista todos los sitios

# wp site list –field=url

Busca y reemplza en multisitio

# wp search-replace –network ‘http://oldURL’ ‘http://newURL’ –url=rootdomain –dry-run(no aplica cambios) –allow-root

# wp search-replace ‘mimudanzafacil.com.mx’ ‘mimudanzafacil.nayaa.mx’ –allow-root –dry-run(no lleva http)

# wp cache flush –allow-root

Table of Contents

Deja un comentario