admin管理员组

文章数量:1125603

My (inherited) WordPress website is setup like this:

  • example is the main version of the site
  • en.example is the English language version of the site. The subdomain's root is pointed to a en sub-directory within main website, like so example/en. That sub-directory has its own WordPress administration
  • de.example is the German language version of the site. Like the English version, this one's root is also pointed to a sub-directory of the main website - example/de

On the old hosting, each of the websites had its own database.

Then the website was migrated to another host, and due to various limitations of that new host, I was unable to have more than one database. So, I did the following:

  • merged all the databases into one
  • the main site's database tables kept their wp_ prefix
  • the en and de tables received a prefix of wp_<language>_ . For example wp_en_posts, or wp_en_options, or wp_de_posts, and so on
  • the change was done in a text editor (a simple string replace)
  • the entire contents of en and de SQL files were then copy/pasted into the SQL file for the main version of the website
  • the changed SQL file was imported via phpMyAdmin (no errors)
  • $table_prefix was adapted for wp-config.php for subdomains. For example, for example/en/wp-config.php, it was $table_prefix = 'wp_en_';
  • nothing was changed in respective .htaccess files

After the changes, I tested if the site loaded as expected - it did, nothing was broken, and the correct content was displayed. I tested the login to the WP dashboard of the main website, and that was also working.

However, I can't access the WP dashboard for en and de versions of the website. I can go to en.example/wp-admin, fill out the login form, and submit it. Unfortunately, that only redirects me to en.example, and when I try to go to en.example/wp-admin, I get the error:

Sorry, you are not allowed to access this page.


Things I've tried

I've checked the cookies created upon logging in to en.example, and they show the correct sub-domain.

I've also removed almost everything from en.example/en/.htaccess - the only lines left were the default WP entries. This was done just to eliminate .htaccess as the possible cause of the problem:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

WP_HOME and WP_SITEURL were not explicitly defined in appropriate wp-config.php language specific files, as I can access the en.example and de.example without any problems.

How can I resolve this issue, and access the language-specific WordPress dashboard?

本文标签: