Wp plugin deactivate (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
$ wp help plugin deactivate

NAME

  wp plugin deactivate

DESCRIPTION

  Deactivates one or more plugins.

SYNOPSIS

  wp plugin deactivate [<plugin>...] [--uninstall] [--all] [--network]

OPTIONS

  [<plugin>...]
    One or more plugins to deactivate.

  [--uninstall]
    Uninstall the plugin after deactivation.

  [--all]
    If set, all plugins will be deactivated.

  [--network]
    If set, the plugin will be deactivated for the entire multisite network.

EXAMPLES

    # Deactivate plugin
    $ wp plugin deactivate hello
    Plugin 'hello' deactivated.
    Success: Deactivated 1 of 1 plugins.

You can deactivate multiple plugins at once, by separating the names by spaces (not by commas):

wp plugin deactivate wp-rocket redis-cache wp-dbmanager iwp-client

Deactivate, delete & uninstall

  • With wp plugin deactivate the plugin is being stopped. No files or settings are affected
  • With wp plugin delete, files are deleted without uninstallation or deactivation
  • With wp plugin uninstall, the uninstall-script of the plugin is executed, after which the files are deleted. The plugin is not deactivated first. You can't first delete and then uninstall, because after delete all files are gone, including the uninstall-script.

So, if you want to be thorough and sure that no trace of a given plugin is left (good luck with that - this depends on the quality of the uninstall-script and might not always be possible at all):

  1. Deactivate
  2. Uninstall

In one piece of code:

i="name-of-the-plugin"; wp plugin deactivate "$i"; wp plugin delete "$i"

See also