Quick Tip: Deactivate All WordPress plugin via the Database

Here is a hack on deactivating WordPress plugins via the database. I discovered it while surfing the internet.
This can be particularly useful if say a plugin broke your site and you were unable to gain access to your WordPress dashboard.
This isn’t difficult a task and you won’t break a sweat performing the ritual 😀

In wp_options table, the option_name active_plugins contains a serialized data as it option_value.
The serialize data contains a list of plugins currently activated.

[sql]
a:6:{i:0;s:41:”aop-alert-old-post/aop-alert-old-post.php”;i:1;s:36:”contact-form-7/wp-contact-form-7.php”;i:2;s:9:”hello.php”;i:3;s:27:”mobilepress/mobilepress.php”;i:4;s:49:”simple-feed-customizer/simple-feed-customizer.php”;i:5;s:41:”wordpress-importer/wordpress-importer.php”;}
[/sql]

Passing the serialize string to unserialize() convert it to an array


Array
(
    [2] => aop-alert-old-post/aop-alert-old-post.php
    [3] => contact-form-7/wp-contact-form-7.php
    [4] => hello.php
    [5] => mobilepress/mobilepress.php
    [6] => simple-feed-customizer/simple-feed-customizer.php
    [7] => wordpress-importer/wordpress-importer.php
)

Back to the business of the day. To deactivate all WP plugins, cut out the serialized string and save.
Alternatively, execute the SQL query below
[sql]
UPDATE wp_options SET option_value = ” WHERE option_name = ‘active_plugins’;
[/sql]

Rule of thumb

Backup your Database before undertaking this task.

Credit to Jeff Starr of Perishable Press

Don’t miss out!
Subscribe to My Newsletter
Invalid email address