Last active
November 10, 2023 18:26
-
-
Save strangerstudios/7751640 to your computer and use it in GitHub Desktop.
SQL to change the id of a Paid Memberships Pro level from old_id to new_id. Please BACKUP YOUR DATABASE FIRST, make sure to change the DB table names to match your prefix, and make sure that there is not another level with
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change these vars | |
SET @old_id = 2; | |
SET @new_id = 1; | |
# change the db table prefix here | |
UPDATE IGNORE wp_pmpro_membership_levels SET id = @new_id WHERE id = @old_id; | |
UPDATE IGNORE wp_pmpro_discount_codes_levels SET level_id = @new_id WHERE level_id = @old_id; | |
UPDATE IGNORE wp_pmpro_membership_orders SET membership_id = @new_id WHERE membership_id = @old_id; | |
UPDATE IGNORE wp_pmpro_memberships_categories SET membership_id = @new_id WHERE membership_id = @old_id; | |
UPDATE IGNORE wp_pmpro_memberships_pages SET membership_id = @new_id WHERE membership_id = @old_id; | |
UPDATE IGNORE wp_pmpro_memberships_users SET membership_id = @new_id WHERE membership_id = @old_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This hasn't been updated in 10 years but I'm happy to report it mostly works though a few new tables were part of my installation at least.
Here's the code that I used: