WordPress – how to install wp-cli on Ubuntu

Start by downloading wp-cli

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

Then give him the right to be executed

chmod +x wp-cli.phar

Then move it to /usr/local/bin to be able to use the wp command

sudo mv wp-cli.phar /usr/local/bin/wp
Publicités

To use the command, simply go into the folder containing the wordpress installation

$ wp

NAME

  Wp

DESCRIPTION

  Manage WordPress through the command-line.

Synopsis

  Wp<command></command>

SUBCOMMANDS

  akismet Filter spam comments.
  Cache Adds, removes, fetches, and flushes the WP Object Cache object.
  cap Adds, removes, and lists capabilities of a user role.
  cli Reviews current WP-CLI info, checks for updates, or views defined aliases.
  how Creates, updates, deletes, and moderates comments.
  config Generates and reads the wp-config.php file.
  core Downloads, installs, updates, and manages a WordPress installation.
  cron Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules.
  db Performs basic database operations using credentials stored in wp-config.php.
  embed Inspects oEmbed providers, clears embed cache, and more.
  eval Executes arbitrary PHP code.
  eval-file Loads and executes a PHP file.
  Export Exports WordPress content to a WXR file.
  help Gets help on WP-CLI, or on a specific command.
  i18n Provides internationalization tools for WordPress projects.
  import imports content from a given WXR file.
  language Installs, activates, and manages language packs.
  maintenance-mode Activates, deactivates or checks the status of the maintenance mode of a site.
  media Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
  Lists menu, creates, assigns, and deletes the active theme's navigation menus.
  Network Perform network-wide operations.
  Retrieves and sets site options option, including plugin and WordPress settings.
  package Lists, installs, and removes WP-CLI packages.
  plugin Manages plugins, including installs, activations, and updates.
  Post Manages posts, content, and meta.
  post-type Retrieves details on the site's registered post types.
  rewrite Lists or flushes the site's rewrite rules, updates the permalink structure.
  role Manages user roles, including creating new roles and resetting to defaults.
  scaffold Generates code for post types, taxonomy, plugins, child themes, etc.
  search-replace Searches/replaces strings in the database.
  Launche servers PHP's built-in web server for a specific WordPress installation.
  shell Opens an interactive PHP console for running and testing PHP code.
  sidebar Lists registered sidebars.
:

And here’s 🙂

Publicités

Leave a Reply