Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

How to manage WordPress plugins

Carl Alexander edited this page Oct 5, 2016 · 3 revisions

Contents

  1. Installing a new plugin
  2. Deactivating a plugin
  3. Keeping a plugin up-to-date
  4. Removing an existing plugin
  5. Managing a plugin on a multisite network
  6. Updating your server

How to manage WordPress plugins

Plugins are a necessary component of any WordPress site. Almost every WordPress site uses plugins to customize its behavior. This guide will show you how to manage plugins on your WordPress server using DebOps.

You'll learn how to perform common plugin tasks. It'll teach you how to install, deactivate, update and remove a plugin. You'll also see how to perform these tasks on a multisite network.

This guide assumes that you're familiar with how to customize your server. If you don't know how or aren't sure, take a moment to go over this guide first.

Installing a new plugin

DebOps lets you manage plugins using the wordpress__plugins option. wordpress__plugins is the list of plugins that DebOps controls on your server. To install a new plugin, you just need to add the plugin slug to it. Here's an example:

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__plugins:
  - name: 'ricg-responsive-images'

This tells DebOps to install the "RICG Responsive Images" plugin. ricg-responsive-images is the slug of the plugin. You can find a plugin's slug by looking at its URL in the WordPress plugin directory. For example, you'd find the "RICG Responsive Images" plugin at https://wordpress.org/plugins/ricg-responsive-images/.

Deactivating a plugin

Deactivating a plugin is quite simple. You only need to add enabled: False below any plugin that you want DebOps to disable. You can find our updated example below.

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__plugins:
  - name: 'ricg-responsive-images'
    enabled: False

It's worth noting that this only disables the plugin. It doesn't remove it from your server. You have to be careful using this option. Let's say that you re-enable the plugin yourself. If you rerun debops wordpress, it'll disable the plugin again.

Keeping a plugin up-to-date

You can also have DebOps update plugins for you. You just need to add state: 'latest' below any plugin that you want DebOps to update. Here's an example:

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__plugins:
  - name: 'ricg-responsive-images'
    state: 'latest'

By default, DebOps won't update a plugin. It'll just ensure that the server has it installed. That's because you might not want plugins to update whenever you run debops wordpress. That's why you have to set the option for it to happen.

Removing an existing plugin

To remove a plugin, you just need to set the state: 'absent' below any plugin you want DebOps to remove. You can see it in the example below. It shows you how to tell DebOps to remove a plugin from your server if it has it installed.

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__plugins:
  - name: 'ricg-responsive-images'
    state: 'absent'

Managing a plugin on a multisite network

Things are a bit different if you use a multisite network. If you have the wordpress__multisite set to True, plugins are network activated by default. You can change this behaviour by setting network: False (as shown below). This tells DebOps to only activate the plugin on the main WordPress site and not the network.

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__multisite: True

wordpress__plugins:
  - name: 'ricg-responsive-images'
    network: False

Updating your server

You don't need to create a new server to manage WordPress plugins. DebOps can update an existing server with the plugin changes you defined in wordpress__plugins. You just need to run the WordPress DebOps playbook.

$ debops wordpress