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
-- delete any usermeta specific to the other subsites | |
delete from wp_usermeta where meta_key regexp '^wp_([0-9]+)_'; | |
-- duplicate the wp_usermeta structure in a working data table, | |
-- but add a unique index for filtering out duplicates | |
create table _fix_usermeta like wp_usermeta; | |
alter table _fix_usermeta add unique(user_id, meta_key); | |
-- copy the site-specific usermeta, keeping only the last of each duplicate | |
insert into _fix_usermeta |