Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 3 voices.

Last updated by Bobby 8 months, 2 weeks ago.

Assisted by: Bobby.

Author Posts
October 17, 2023 at 6:52 pm #14597349

stefanieW-5

After logging in as admin on /wp-admin, and redirection to the admin backend overview (dashboard), the website shows an error 403 forbidden ("You don't have permission to access this resource."). I.e., I cannot access the admin dashboard.

Error 403 Forbidden will consistently reappear on reloading /wp-admin.

Navigating to the frontend homepage (hidden link) also shows a Error 403 Forbidden.

When I navigate to a product detail page (e.g. /product/product-a) after having logged in, the error instantly disappears. I can now also access the admin dashboard.

Reloading /wp-admin after the initial login several times by smashing F5 will allow me to suddenly access /wp-admin. This, however, only happens after an arbitrary amount of seconds (not a certain amount of refreshes!).

The error also appears when logging in the browser's inkognito/private mode.

The error does not appear when WPML is deactivated. Leaving WPML active as sole plugin reproduces the error.

The WP error debug log does not contain any meaningful output related to this problem.

Regenerating .htaccess did not seem to solve the problem.

Switching to a different PHP version did not seem to solve the problem.

The error appeared in timely connection to us switching the hosting server, but I cannot recall whether this was actually related/the cause.

The website is hidden link.

October 18, 2023 at 8:12 am #14599821

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

Can you add this code to your active theme's functions.php file:


function wpmlsupp_1706_reset_wpml_capabilities() {
    if ( function_exists( 'icl_enable_capabilities' ) ) {
        icl_enable_capabilities();
    }
}
add_action( 'shutdown', 'wpmlsupp_1706_reset_wpml_capabilities' );

Then open a page on the front-end and/or back-end and check if the problem disappears.

If it doesn't, then please enable the debug.log as shown in the guide i'm linking here, and send me the file if it's created after you get a 403 error. you can upload it into any platform you like such as google drive or wetransfer: https://wpml.org/documentation/support/debugging-wpml/

Try it out and let us know how it goes.

October 18, 2023 at 2:53 pm #14606013

stefanieW-5

Thank you. This does not solve the problem.

Please find the debug.log here:

hidden link

The log was created as per your guide:
- Activated the debugging in wp-config.php
- Reproduced the error.
- Deactivated debugging again.

In contrast to my original post, the last line of the debug.log may be relevant:
[18-Oct-2023 14:48:05 UTC] PHP Warning: Cannot modify header information - headers already sent in /var/www/vhosts/(hidden)/httpdocs/wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/class-wpml-language-per-domain-sso.php on line 123

October 20, 2023 at 5:33 am #14620517

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

Taking a look at your site I can see that you use a different domain per language, along with the warning in your error log and the recent hosting move I highly recommend reviewing the following documentation and ensuring everything is still set up per our documentation.

Provide this documentation to your hosting support as well to ensure this from their side as well.

Documentation:
https://wpml.org/documentation/getting-started-guide/language-setup/language-url-options/how-to-use-wpml-with-different-domains-per-language/

October 20, 2023 at 1:35 pm #14623975

stefanieW-5

Thank you. It appears that the issue is connected with the "Automatically login user for all domains"-setting.

If I deactivate the setting, the error does not appear.

If I activate the setting, the error does appear as outlined in the original post.

I would like to use this setting, so it would be great if you could provide further assistance.

The DNS settings are all correct.

October 20, 2023 at 5:51 pm #14626457

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Does your current hosting environment use Cloudflare or a caching system such as redis? If possible check for potential errors that would cause the 403.

This is coming from the hosting/domain side and not caused due to a bug in WPML's code.

From the WPML side, WPML needs to be able to send data cross-domain via POST or GET method in order for login data to be passed to other language domains and for you to stay logged in or not get a 403 error.

- https://wpml.org/documentation/getting-started-guide/language-setup/passing-session-data-between-languages-in-domains/

stefanieW-5 confirmed that the issue was resolved on 2023-10-21 07:49:17.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.