Sometimes it may be necessary to remove all WP-Members entries in the database. While the plugin can generally clean up after itself using the “delete” option in the WP Plugins panel, this essentially removes settings information. There are some additional entries that may be left behind depending on your configuration. This includes some user meta data, and if membership products are used, some post meta data.
Similarly, if you have installed and used any of the plugin’s extensions, these will remove most settings when deleted, but will leave license information and some meta data. Any extensions that have a custom table will leave that table in case the data is desired later.
Anything that is left behind is data that would not be easily restored if the plugin were being reinstalled. If it is necessary to completely clean the data, the following MySQL queries can be run to remove all options, meta data, and custom tables. This will remove all settings created WP-Members and its extensions. Some of these may be removed already if the delete option was run, but are included in the script for situations where maybe the files were deleted without running the delete option.
Instructions:
- Backup your database.
- The default script uses the “wp_” table prefix. Make certain this matches your table prefix (and if you run multiple WP installs on a single database, make doubly certain that you have the right one). Use a text editor to find/replace the prefix if you have a different prefix.
- If you want to remove user data from custom user fields, make a note of the meta keys of these fields. At the end of the first section (the WP-Members core settings) there is a delete query that is commented out. Remove the comment and edit the meta key value. Copy/paste for each field you want to remove.
- Run the queries in a db manager such as phpMyAdmin or MySQL Workbench.
# Set of MySQL queries to remove any and all WP-Members database # entries from the WordPress database. This should only be used # for a complete and total removal where a clean start is needed # as it removes not only settings but also any WP-Members-specific # user and post data. # WP-Members main plugin DELETE FROM wp_options WHERE option_name = "_transient_wpmem_user_counts"; DELETE FROM wp_options WHERE option_name = "_transient_timeout_wpmem_user_counts"; DELETE FROM wp_options WHERE option_name = "_transient__wpmem_hidden_posts"; DELETE FROM wp_options WHERE option_name = "_transient_timeout__wpmem_hidden_posts"; DELETE FROM wp_options WHERE option_name = "widget_widget_wpmemwidget"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_attrib"; # Pre 3.x, Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_autoex"; # Pre 3.x, Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_captcha"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_cssurl"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_dialogs"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_dropins"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_appmod"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_footer"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_getuser"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_newmod"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_newreg"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_notify"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_repass"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_wpfrom"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_wpname"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_fields"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_logurl"; # Pre 3.x, Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_msurl"; # Pre 3.x, Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_regurl"; # Pre 3.x, Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_settings"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_style"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_tos"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_usfields"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_utfields"; # Removed by uninstall DELETE FROM wp_postmeta WHERE meta_key = "wpmem_product_role"; DELETE FROM wp_postmeta WHERE meta_key = "wpmem_product_expires"; DELETE FROM wp_postmeta WHERE meta_key = "wpmem_product_name"; DELETE FROM wp_postmeta WHERE meta_key = "_wpmem_products"; DELETE FROM wp_postmeta WHERE meta_key = "_wpmem_block"; DELETE FROM wp_postmeta WHERE meta_key LIKE "_wpmem_products_%"; DELETE FROM wp_posts WHERE post_type = "wpmem_product"; DELETE FROM wp_usermeta WHERE meta_key LIKE "_wpmem_products_%"; DELETE FROM wp_usermeta WHERE meta_key = "active"; DELETE FROM wp_usermeta WHERE meta_key = "wpmem_reg_ip"; DELETE FROM wp_usermeta WHERE meta_key = "wpmem_reg_url"; DROP TABLE IF EXISTS wp_wpmembers_user_search_keys; # The following can be used (and duplicated as needed) to remove custom user fields # DELETE FROM wp_usermeta WHERE meta_key = "my_field_meta_key"; # Advanced Options DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-advanced-options"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-advanced-options-email"; DELETE FROM wp_options WHERE option_name = "wp-members-advanced-options-license"; DELETE FROM wp_options WHERE option_name = "wpmembers_advanced"; # Removed by uninstall DELETE FROM wp_postmeta WHERE meta_key = "_wpmem_adv_redirect"; DELETE FROM wp_postmeta WHERE meta_key = "_wpmem_adv_post_role"; # Download Protect DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-download-protect"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-download-protect-email"; DELETE FROM wp_options WHERE option_name = "wp-members-download-protect-license"; DELETE FROM wp_options WHERE option_name = "wpmem_dp_db_version"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_download_protect"; # Removed by uninstall DELETE FROM wp_postmeta WHERE meta_key = "_wpmem_dp_key"; DROP TABLE IF EXISTS wp_wpmem_downloadstats; # Invite Codes DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-invite-codes"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-invite-codes-email"; DELETE FROM wp_options WHERE option_name = "wp-members-invite-codes-license"; DELETE FROM wp_options WHERE option_name = "wpmembers_ic_db_version"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_invitecodes"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_ic_invite"; # Removed by uninstall DROP TABLE IF EXISTS wp_wpmem_invite_codes; DROP TABLE IF EXISTS wp_wpmem_invite_codes_meta; # MailChimp Integration DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-mailchimp-integration"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-mailchimp-integration-email"; DELETE FROM wp_options WHERE option_name = "wp-members-mailchimp-integration-license"; DELETE FROM wp_options WHERE option_name = "wpmembers_mailchimp"; # Removed by uninstall # Memberships for WooCommerce DELETE FROM wp_options WHERE option_name = "wp-members-memberships-for-woocommerce-email"; DELETE FROM wp_options WHERE option_name = "wp-members-memberships-for-woocommerce-license"; DELETE FROM wp_postmeta WHERE meta_key = "_membership_product_links"; # PayPal Subscriptions DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-expiration"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-expiration-email"; DELETE FROM wp_options WHERE option_name = "wp-members-expiration-license"; DELETE FROM wp_options WHERE option_name = "wpmem_exp_db_version"; DELETE FROM wp_options WHERE option_name = "wpmem_exp_reminder"; DELETE FROM wp_options WHERE option_name = "wpmem_experiod"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmem_paypal"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_email_wpmem_exp_reminder"; DELETE FROM wp_usermeta WHERE meta_key = "exp_type"; DELETE FROM wp_usermeta WHERE meta_key = "expires"; DROP TABLE IF EXISTS wp_wpmem_paypal_transactions; # Security DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-security"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-security-email"; DELETE FROM wp_options WHERE option_name = "wp-members-security-license"; DELETE FROM wp_options WHERE option_name = "wpmembers_blacklist"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_security"; # Removed by uninstall DELETE FROM wp_usermeta WHERE meta_key = "_wpmem_sec_previous_pwds"; DELETE FROM wp_usermeta WHERE meta_key = "wpmem_password_flag"; DELETE FROM wp_usermeta WHERE meta_key = "wpmem_password_timestamp"; # Text Editor DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-text-editor"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-text-editor-email"; DELETE FROM wp_options WHERE option_name = "wp-members-text-editor-license"; DELETE FROM wp_options WHERE option_name = "wpmembers_editor"; # Removed by uninstall # User List DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-user-list"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-user-list-email"; DELETE FROM wp_options WHERE option_name = "wp-members-user-list-license"; DELETE FROM wp_options WHERE option_name = "wpmembers_ul_fields"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_ul_search"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_ul_settings"; # Removed by uninstall DELETE FROM wp_usermeta WHERE meta_key = "wpmem_ul_profile_slug"; # User Tracking DELETE FROM wp_options WHERE option_name = "external_updates-wp-members-user-tracking"; # Legacy update class DELETE FROM wp_options WHERE option_name = "wp-members-user-tracking-email"; DELETE FROM wp_options WHERE option_name = "wp-members-user-tracking-license"; DELETE FROM wp_options WHERE option_name = "wpmem_stats_db_version"; # Removed by uninstall DELETE FROM wp_options WHERE option_name = "wpmembers_stats_settings"; # Removed by uninstall DELETE FROM wp_usermeta WHERE meta_key = "wpmemstat_last_login"; DROP TABLE IF EXISTS wp_wpmem_userstats;