Skip to content

Latest commit

 

History

History
225 lines (146 loc) · 10.8 KB

plugin.md

File metadata and controls

225 lines (146 loc) · 10.8 KB

Plugin

Manage wordpress plugins through wp cli.

Kind: global class

new Plugin(site)

Constructor for the Plugin object

Param Type Description
site Container the wordpress site to work on.

plugin.wpPlugin(commands) ⇒ Promise.<RunInContainerOutput>

Run wp plugin command on a wp cli continer that connected to the site provied in the constructor.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - The output of the command

Param Type Description
commands Array.<string> commands passing to wp plugin

plugin.activate(plugin) ⇒ Promise.<RunInContainerOutput>

Activate one or more plugins.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - The output of the command.

Param Type Description
plugin string | Array.<string> | 'all' One or more plugins to activate, use 'all' to activate all plugins.

Example

const plugin = new Plugin(WordPress)

//Activate one plugin
plugin.activate('elementor')

//Activate all plugins
plugin.activate('all')

plugin.deactivate(plugin, uninstall) ⇒ Promise.<RunInContainerOutput>

Deactivate one or more plugins.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - The output of the command.

Param Type Description
plugin string | Array.<string> | 'all' One or more plugins to deactivate, use 'all' to deactivate all plugins.
uninstall boolean Uninstall the plugin after deactivation.

Example

const plugin = new Plugin(WordPress)

//Deactivate one plugin
plugin.deactivate('elementor')

//Deactivate all plugins
plugin.deactivate('all')

plugin.delete(plugin) ⇒ Promise.<RunInContainerOutput>

Deletes one or more plugins.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - The output of the command.

Param Type Description
plugin string | Array.<string> | 'all' One or more plugins to delete, use 'all' to delete all plugins.

Example

const plugin = new Plugin(WordPress)

//Delete one plugin
plugin.delete('Twenty Twenty')

//Delete all plugins
plugin.delete('all')

plugin.get(plugin) ⇒ Promise.<PluginGetObject>

Get plugin data.

Kind: instance method of Plugin
Returns: Promise.<PluginGetObject> - Current plugin data.

Param Type Description
plugin string The plugin to get.

plugin.install(plugin, activate, version) ⇒ Promise.<RunInContainerOutput>

Installs one or more plugins.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - The output of the command.

Param Type Description
plugin string | Array.<string> One or more plugins to install. Accepts a plugin slug, the path to a local zip file, or a URL to a remote zip file.
activate boolean If set, the plugin will be activated immediately after install.
version string Get that particular version from wordpress.org, instead of the stable version.

plugin.isActive(plugin) ⇒ Promise.<boolean>

Checks if a given plugin is active.

Kind: instance method of Plugin
Returns: Promise.<boolean> - Whether plugin is active

Param Type Description
plugin string The plugin to check.

plugin.isInstalled(plugin) ⇒ Promise.<boolean>

Checks if a given plugin is installed.

Kind: instance method of Plugin
Returns: Promise.<boolean> - Whether plugin is installed

Param Type Description
plugin string The plugin to check.

plugin.list([filters]) ⇒ Promise.<Array.<PluginListFiltersObject>>

Return list of plugin installed in the wordpress site and there data.

Kind: instance method of Plugin
Returns: Promise.<Array.<PluginListFiltersObject>> - - List of plugin installed in the wordpress site.

Param Type Description
[filters] PluginListFiltersObject Filter results based on the value of a field.

plugin.path(plugin) ⇒ Promise.<RunInContainerOutput>

Gets the path to a plugin or to the plugin directory.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - Path to a plugin or to the plugin directory.

Param Type Description
plugin string The plugin to get the path to.

plugin.uninstall(plugin) ⇒ Promise.<RunInContainerOutput>

Uninstalls one or more plugins.

Kind: instance method of Plugin
Returns: Promise.<RunInContainerOutput> - Path to a plugin or to the plugin directory

Param Type Description
plugin string | Array.<string> | 'all' One or more plugins to uninstall.

Example

const plugin = new Plugin(WordPress)

//Uninstall one plugin
plugin.uninstall('elementor')

//Uninstall all plugins
plugin.uninstall('all')