Lately I've been working with a separate instance of my WordPress site for development and testing of plugins, my theme, etc. I have a helper script that orchestrates the pulling of files and copying of the database from the production server into the dev server. I found that it would be nice to disable certain plugins that I don't want running in the dev instance (ie, plugins that notify search indexes when new posts are made) from within this script.

I whipped up this script for that purpose:

% php wp_disable_plugins.php
Active plugins:
- add-to-feed/add-to-feed.php
- dynamic-categories-widget/dynamic-categories.php
- growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php
- link-to-post/link-to-post.php
- map-categories-to-pages/map-categories-to-pages.php
- mce-table-buttons/mce_table_buttons.php
- page-tagger/page-tagger.php
- php-enkoder/enkoder.php
- quotes-collection/quotes-collection.php

Specify plugin name(s) from above on the command line to disable them.

% php wp_disable_plugins.php add-to-feed/add-to-feed.php
Disabled 1/1 plugins.

That's all there is to it.

This script is also helpful if a plugin goes haywire and for some reason prevents you from logging into the admin panel.

Update: Thanks to feedback from Mark Kreyman, I've updated the script so it picks up the $table_prefix from wp-config.php. This should prevent errors in a lot of installations.

Download: wp_disable_plugins.php