I have used the NextGen Gallery WordPress plugin on a bunch of different projects and have always been satisfied with the functionality. On a recent WordPress project I was working on I installed NextGen Gallery assuming I would use it however after I got a bit further on the project I decided it wasn’t necessary and that it would be easier to simply use the default WordPress media uploading capabilities along with the “Lightbox 2” and the “Flexible Upload D3Z Edition” WordPress plugins instead. While NextGen gallery has tons of functionality and typically is easy to use for this project there would be many authors and I needed the path of least resistance to allow authors to write articles.
Anyhow after NextGen Gallery is deactivated there are a couple MySQL tables that should be cleaned up so there is no trace of the plugin left in the MySQL database and there are a couple directories that should be removed to save disk space and make sure the plugin is completely removed from the system. I suggest making a backup of the entire NextGen plugin directory, any media that has been uploaded via the plugin, and of the database tables before you drop them from MySQL. If you decide you want to reinstall the plugin or need any data associated with the NextGen Gallery plugin then you could easily do so with the backup of the data and the database content. Follow the directions below to not only remove the plugin itself but then to use the MySQL command line interface(CLI) to drop the necessary tables.
Remove The NextGen Gallery Plugin From Your WordPress Installation:
- Deactivate The Plugin:First you just need to deactivate the plugin. Login to the WordPress admin, click on Plugins in the left navigation menu, select Active from the top set of links, scroll down to NextGen Gallery, and click the Deactivate link below the NextGen Gallery.
- Delete NextGen Gallery Plugin: Now using an FTP client or using SSH remove the entire nextgen-gallery directory from the wordpress-root/wp-content/plugins directory. You could attempt to delete the plugin from the WordPress admin but I always find it easier to do so using an FTP client or SSH’d into the server to make sure everything is deleted properly. Again make sure to backup this directory on your local PC or the server before deleting.
- Remove Gallery Directory And Files:Depending on how long you have used NextGen Gallery the gallery directory could be huge so compress the contents using something like tar and/or gzip and then remove the gallery directory typically located in the /wordpress-root/wp-content directory.
- Remove MySQL Tables: Now use the below SQL commands to drop each of the tables related to the NextGen Gallery plugin from the database. Don’t forget to add/modify the proper prefix to each table if you have modified the table prefix from the default of “wp”. Login to MySQL with the root user or a user that has DROP permissions on the WordPress MySQL database that your WP installation uses.Remove NextGen Gallery Tables From MySQL:
- DROP TABLE wp_ngg_album;
- DROP TABLE wp_ngg_gallery;
- DROP TABLE wp_ngg_pic2tags;
- DROP TABLE wp_ngg_pictures;
- DROP TABLE wp_ngg_tags;
Example Dropping NextGen Gallery Table With Success:sql
- mysql> DROP TABLE wp_ngg_pictures;
- Query OK, 0 rows affected (0.03 sec)
It may look like nothing was deleted but the drop command will literally remove the table and all of its contents in a very quick manner. Again make sure the data is backed up in case you accidentally need something at a later date.
Example Attempting To Drop NextGen Gallery Table With Error:sql
- mysql> DROP TABLE wp_ngg_pictures;
- ERROR 1051 (42S02): Unknown table 'wp_ngg_pictures'
You could receive the above error if you didn’t modify the table prefix to whatever your WP table prefix is. The default table prefix for WordPress is “wp” though you should modify this as a security meaure among. You could also get this error if you misspelled the table name or accidentally tried to remove it for a second time.
- Remove NextGen Gallery WordPress Page References: Last but not least make sure you modify or delete any pages that reference any NextGen Gallery shortcodes or modify any WordPress posts that reference media uploaded through the NextGen Gallery plugin.
That is all you have to do. NextGen Gallery is no longer installed on your WP blog and you have removed all of the traces of the software including the database tables.