Modify Database in Multi-Site wp_usermeta table

This Should Work? ALTER TABLE wp_usermeta ADD COLUMN old_user_id bigint(20) unsigned; INSERT INTO wp_usermeta (old_user_id) SELECT u.id FROM wp_users AS u; INSERT INTO wp_usermeta (user_id, meta_key, meta_value) SELECT u.id, ‘wp_2_capabilities’, meta_value JOIN wp_users AS u ON u.user_id = u.old_user_id; ALTER TABLE wp_users DROP COLUMN old_user_id;

Check if column exists for one table in DB

I found this solution : here So… class MainClassAddon{ public function __construct(){ register_activation_hook( __FILE__, array( $this, ‘install’ ) ); } public function install(){ $row = $wpdb->get_results( “SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name=”wp_t” AND column_name=”c”” ); if(empty($row)){ $wpdb->query(“ALTER TABLE wp_t ADD c INT(1) NOT NULL DEFAULT 1”); } } } new MainClassAddon(); register_uninstall_hook( __FILE__, array( ‘PluginNamespace\MainClassAddon’, … Read more

Are theme .php files stored in the database?

No, a theme’s .php files are not stored in the database. Themes should not be hardcoding URLs in their files. However, it’s totally possible for this to happen, particularly with a custom theme or plugins whose developer did not follow best practices. I’d suggest using a search utility such as grep (grepwin is nice for … Read more