Bug Summary
When migrating a WordPress site from a Linux server to Local on Windows, Local normalizes the database table prefix to lowercase and updates $table_prefix in wp-config.php, but fails to update the corresponding WordPress option and usermeta keys.
This causes WordPress to lose the administrator role definition and user capabilities, resulting in “Sorry, you are not allowed to access this page” errors in the WordPress dashboard.
Steps to reproduce
-
Set up a WordPress site on a Linux server.
-
Configure a mixed-case database table prefix, for example:
Ab3Cd7Ef_ -
Ensure the following database keys use the same mixed-case prefix:
-
Ab3Cd7Ef_user_rolesin the options table. -
Ab3Cd7Ef_capabilitiesin the usermeta table. -
Ab3Cd7Ef_user_levelin the usermeta table.
-
-
Migrate the site to Local running on Windows.
-
Inspect the database table names, the corresponding option and usermeta keys, and
$table_prefixinwp-config.php.
Actual result:
Local changes the database table names and $table_prefix to lowercase:
mi9ja37qujiv1k_
However, the three prefix-dependent database keys retain their original mixed-case names.
WordPress therefore cannot find the expected role and capability entries.
Expected result:
When Local normalizes the database table prefix, it should also normalize all corresponding prefix-dependent option and usermeta keys.
Verified workaround:
Manually rename the following three keys to match the lowercase prefix, without modifying their values:
| Table | Original key | Corrected key |
|---|---|---|
ab3cd7ef_options |
Ab3Cd7Ef_user_roles |
ab3cd7ef_user_roles |
ab3cd7ef_usermeta |
Ab3Cd7Ef_capabilities |
ab3cd7ef_capabilities |
ab3cd7ef_usermeta |
Ab3Cd7Ef_user_level |
ab3cd7ef_user_level |
After renaming these keys, administrator permissions work correctly.
Environment Info
-
Operating System: Windows 11
-
Local version: 10.1.2+7004
-
Source server OS: Linux
-
WordPress version: 7.1.4
-
Web server: [Please specify: Nginx / Apache]
-
PHP version: 8.3.36
-
Database: MariaDB 10.11.18
-
Migration method: ZIP import
Supporting info
The issue was identified by comparing $table_prefix in wp-config.php with the corresponding option and usermeta keys in the migrated database.