WP-CLI

  • WP-CLI – What is it? WP-CLI provides a command-line interface for many actions you might perform in the WordPress admin dashboard.
  • Why use it? It’s fast. Faster than using the WordPress admin (not as many “clicks”) and faster than performing modifications  via FTP. Also, comes in quite handy if your frozen out of the admin.
  • How is it used? For example, you can manage site users by typing the command: wp users. You can download, install and activate a plugin in seconds with: wp plugin. See the interactive table below for a list of commands.
  • What else? WP-CLI also includes commands for many things you can’t do in the WordPress admin or via FTP. For example, the command: wp transient delete, lets you delete one or all transients from your database.

REQUIRED

  • SSH – You need SSH (Secure Shell) access. SSH allows you remotely operate network services securely. It’s the “gateway” through your site’s hosting server to WP-CLI. Many, but not all web hosts, provide SSH access. Some do, but without access to WP-CLI. We provide both at our web hosting sister site; The Site Hosting Co. If you are not hosted with us, ask your web host for support.
  • SSH Client – You need an SSH Client to access your site’s hosting server. This is software you download and install to your desktop/laptop. If you are a Windows user, this is a must. Mac, you can use the built-in Terminal function. PuTTY is an SSH Client you can download and use for free. It’s a small executable file with no setup or instructions required. Just download, click to install, and you are good to go. For details in connecting to your site through PuTTY, see the infographic below.

Hover your mouse over this image to reveal instructions:

WP-CLI COMMANDS

A list of useful commands you can use with WP-CLI
COMMAND (click the links for more information)PURPOSE
wp cacheManage the object cache
wp capManage user capabilities
wp checksumVerify WordPress core checksums
wp cliReview current WP-CLI info, check for updates, or see defined aliases
wp commentManage comments
wp configManage the wp-config.php file
wp coreDownload, install, update and manage a WordPress install
wp cronManage WP-Cron events and schedules
wp dbPerform basic database operations using credentials stored in wp-config.php
wp evalExecute arbitrary PHP code
wp eval-fileLoad and execute a PHP file
wp exportExport WordPress content to a WXR file
wp helpGet help on WP-CLI, or on a specific command
wp importImport content from a WXR file
wp languageChange language for WordPress
wp mediaImport new attachments or regenerate existing ones
wp menuList, create, assign, and delete menus
wp networkManage multisite
wp optionManage options
wp packageManage WP-CLI packages
wp pluginManage plugins
wp postManage posts
wp post-typeManage post types
wp rewriteManage rewrite rules
wp roleManage user roles
wp scaffoldGenerate code for post types, taxonomies, plugins, child themes, etc.
wp search-replaceSearch/replace strings in the database
wp serverLaunch PHP’s built-in web server for this specific WordPress installation
wp shellInteractive PHP console
wp sidebarManage sidebars
wp sitePerform site-wide operations
wp super-adminManage super admins on WordPress multisite
wp taxonomyManage taxonomies
wp termManage terms
wp themeManage themes
wp transientManage transients
wp userManage users
wp widgetManage sidebar widgets

Share This