Gestion des plugins en ligne de commande

Voici un petit tutoriel pour gérer les plugins de son site sans se connecter à l’admin de WordPress.

L’utilitaire wp-cli permet de gérer son site tout en ligne de commande.

Pour voir la liste des plugins installés

wp plugin list

+----------------------------+--------+--------+---------+
 | name                       | status | update | version |
 +----------------------------+--------+--------+---------+
 | advanced-custom-fields-pro | active | none   | 5.8.7   |
 | cookie-notice              | active | none   | 1.2.50  |
 | polylang                   | inactive | none   | 2.6.9   |
 | wordpress-seo              | active | none   | 12.9.1  |
 +----------------------------+--------+--------+---------+

Pour activer un plugin

wp plugin activate polylang

Plugin 'polylang' activated.
Success: Activated 1 of 1 plugins.

Pour désactiver un plugin

wp plugin deactivate polylang

Plugin 'polylang' deactivated.
Success: Deactivated 1 of 1 plugins.

Voir l’aide de wp plugin

wp help plugin

NAME

  wp plugin

DESCRIPTION

  Manages plugins, including installs, activations, and updates.

SYNOPSIS

  wp plugin <command>

SUBCOMMANDS

  activate              Activates one or more plugins.
  deactivate            Deactivates one or more plugins.
  delete                Deletes plugin files without deactivating or uninstalling.
  get                   Gets details about an installed plugin.
  install               Installs one or more plugins.
  is-active             Checks if a given plugin is active.
  is-installed          Checks if a given plugin is installed.
  list                  Gets a list of plugins.
  path                  Gets the path to a plugin or to the plugin directory.
  search                Searches the WordPress.org plugin directory.
  status                Reveals the status of one or all plugins.
  toggle                Toggles a plugin s activation state.
  uninstall             Uninstalls one or more plugins.
  update                Updates one or more plugins.
  verify-checksums      Verifies plugin files against WordPress.org's checksums.

[...]

Il est donc possible de lister les plugins installés (actifs ou non), de les activer, les désactiver, les mettre à jour, les installer, les supprimer, etc…

1 comment

Comments are closed.