Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
A bug triggered by specific plugins, producing a 500 error intermittently.
Solution:
We have found out that it is an internal server error triggered by the fact that the .htaccess is altered and /en/ is the rewrite base:

<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /en/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /en/index.php [L]
</ifmodule>

This occurs primarily on a specific page and happens on every heartbeat. This happens when third-party plugins call the flush_rewrite_rules(true) function too often. This can change the rewrite rules in your .htaccess file and cause issues on your WordPress site. The full explanation can be found here:
https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/.

We suggest implementing the workaround on your staging site by adding the following function to the theme's functions.php file.

add_filter('mod_rewrite_rules', 'fix_rewritebase');
function fix_rewritebase($rules){
    $home_root = parse_url(home_url());
    if ( isset( $home_root['path'] ) ) {
        $home_root = trailingslashit($home_root['path']);
    } else {
        $home_root = '/';
    }
   
    $wpml_root = parse_url(get_option('home'));
    if ( isset( $wpml_root['path'] ) ) {
        $wpml_root = trailingslashit($wpml_root['path']);
    } else {
        $wpml_root = '/';
    }
   
    $rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);
    $rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);
   
    return $rules;
}

Relevant Documentation:
https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/

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.

This topic contains 14 replies, has 0 voices.

Last updated by sarahD-3 2 months, 2 weeks ago.

Assisted by: Itamar.

Author Posts
January 27, 2026 at 12:22 pm

sarahD-3

CRITICAL BUG FOUND:
WPML's REST API endpoints are completely broken in translated language directories.
Failing endpoint:
hidden link
Returns: 500 Internal Server Error
Working endpoint (default language):
hidden link
Returns: Valid JSON response
Impact:
This breaks the language switcher for logged-in users because WPML cannot communicate via REST API when in a translated language context (/en/). This causes redirect loops when switching from English back to French.
The WPML → Support page in WordPress admin confirms this issue: "The REST API test endpoint hidden link is not responding correctly."
This is a critical WPML bug that prevents basic language switching functionality.

January 27, 2026 at 1:25 pm #17767290

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

If the problem does not occur when WPML is deactivated, and since we have no other specific PHP errors, please proceed with the following.

We suspect a collision with the theme or another plugin might cause this problem. If possible, get your site into a minimum environment, switching to a default WordPress theme like TwentyTwenty-Four and activating only WPML.

First, check whether the problem persists when only the theme is switched to TwentyTwenty-Four (for example). If it persists, deactivate all plugins except WPML and Strings Translation. Then, please check if the problem persists. If it does not persist, start by activating the plugins individually and checking when the issue comes back, then report to me which plugin was the culprit.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****


*** If your site is live, you might want to try those procedures in a staging environment or a snapshot of your site on your local server or another server. ***

Regards,
Itamar.

January 27, 2026 at 1:38 pm #17767445

sarahD-3

The REST API issue is resolved - that was caused by .htaccess Directory Hardening blocking it.

The critical error on /member-home/ persists even with WPML deactivated, which proves the English page content itself is corrupted. This appears to be a problem with how the English pages were translated/created, not with WPML's core functionality.

Should I delete and recreate the English translations from scratch?

January 27, 2026 at 1:42 pm #17767454

sarahD-3

Also... Important detail - the errors only happen when users are logged in. In incognito mode (logged out), all pages work fine. Does WPML handle authenticated users differently?

January 27, 2026 at 1:54 pm #17767558

sarahD-3

I'm using MemberPress for the member-restricted pages. The errors occur:

- On MemberPress-restricted pages when logged in as a member
- When using the language switcher on Events Calendar pages
- But NOT when directly accessing non-restricted French pages

This suggests a conflict between WPML + MemberPress + Events Calendar. Are there known compatibility issues or specific configuration requirements for this combination?

January 27, 2026 at 1:55 pm #17767560

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Thanks for updating me on your findings.

I meant that you check if the problem persists on the French original pages, like: hidden link.

You wrote: "The critical error on /member-home/ persists even with WPML deactivated, which proves the English page content itself is corrupted. This appears to be a problem with how the English pages were translated/created, not with WPML's core functionality."

If this problem occurred because of the Deston theme or a third-party plugin, my suggestion to try in a minimal environment remains valid. In this case, please try to translate a page from French to English in a minimal environment, as I explained, and check if you still get the problem. If not, then it might be the Deston theme or a third-party plugin.

You asked: "Should I delete and recreate the English translations from scratch?"
Of course, you can try this. But I suggest you try it first on the staging site.

Regards,
Itamar.

January 27, 2026 at 2:04 pm #17767595

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

In addition to what I wrote above, I just noticed you also asked about The Events Calendar and MemberPress plugins.

The Events Calendar is officially compatible with WPML. However, there are a few known issues. Please check them out here: https://wpml.org/plugin/the-events-calendar/

We know MemberPress is incompatible with WPML. We mention this here: https://wpml.org/plugin/memberpress-basic/.

Regards,
Itamar.

January 27, 2026 at 8:54 pm #17768974

sarahD-3

Hello,

I've completed isolation testing on a clean environment:

Setup:

WordPress default theme (Twenty Twenty-Five)
Only WPML + Events Calendar active
All other plugins deactivated (including MemberPress, Deston theme, everything)

Result: 500 errors still occur when switching languages on Events Calendar pages.
This proves it's a core compatibility issue between WPML and Events Calendar. Which specific known issue from your list applies, and what is the fix?

Test it yourself: hidden link (language switcher is in footer)

Also...
You say MemberPress is incompatible with WPML. Does this mean:

MemberPress-restricted pages will not work properly with WPML at all?

Is there any workaround to make member-restricted pages work in multiple languages?

Should I consider replacing MemberPress with a WPML-compatible membership plugin?

Thank you

January 28, 2026 at 9:35 am #17769911

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, and thanks for trying my suggestions.

Yes, I can see the 500 error persists on your site. For example, here: hidden link. Please see the attached screenshot.

I might need to esclate this issue to our second-tier supporters. Please grant me access to your staging site and, if needed, allow me to take a copy of your site. For this, I must install a plugin like Duplicator or All-in-One Migration. Please let me know if you agree. Please also share the FTP access details with me. I want to check for PHP errors, so I need to enable the WordPress debug log in the wp-config.php file. A private message is enabled for the following reply.

Regarding your questions about the MemberPress plugin. I'm sorry, but I don't have any definite answers to your questions. In the following link, we state this:

All tiers (Basic, Plus and Pro) are not fully compatible and require manual translation workflows as described in this MemberPress documentation.

https://wpml.org/plugin/memberpress-basic/
However, I can see that the link points to this MemberPress guide:
hidden link
But this guide does not explain what we mean by manual translation. To learn what we mean when saying manual translation, please check this guide:
https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/.

If you want to can test things with the MemberPress plugin and WPML on the following test site I've created for you:
hidden link
With this link, you will be logged in. WPML is already installed, but not configured. You are welcome to install the MemberPress plugin and test it, including how it works with restricted pages.

You can look up other similar officially compatible plugins in our plugins repository here: https://wpml.org/plugin/. Similar compatible plugins may be the following:
https://wpml.org/plugin-functionality/community/
https://wpml.org/plugin/armember/
https://wpml.org/plugin/ultimate-membership-pro/

Regards,
Itamar.

2026-01-28_10-59-01.jpg
January 28, 2026 at 12:47 pm #17770466

sarahD-3

I just sent you admin credentials and ftp access.
Looking forward to hearing back from you.

Thx

January 28, 2026 at 4:06 pm #17771344

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, and thanks for the access details.

I've found out that the 500 error occurs only when the following plugins are active:
- WPML
- Strings Translation
- The Events Calendar
- Qode Framework
The following error shows up many times in the WordPress debug.log.

PHP Deprecated:  Creation of dynamic property Tribe__Events__Pro__Integrations__WPML__Event_Listener::$wpml is deprecated in /public_html/wp-content/plugins/events-calendar-pro/src/Tribe/Integrations/WPML/Event_Listener.php on line 52

I created a copy of your site using the Aii In One Migration plugin, then deleted the plugin. I escalated this issue to our second-tier supporters. When I have a reply from them, I'll update you here.

I appreciate your patience.
Itamar.

January 28, 2026 at 4:16 pm #17771357

sarahD-3

Remember I was getting the 500 errors even when Qode Framework was disabled and using Twenty Twenty five theme.

January 28, 2026 at 4:44 pm #17771434

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I remember you saying this.
However, when I first visited your staging site, before doing anything, I found the following plugins active.
- Deston Core
- Qode Framework
- The Events Calendar
- The Events Calendar Pro
- WPML
- Strings Translation
Please see the attached screenshot. It is from the time I first logged in.
In any case, I could only trigger the 500 error when the plugins I mentioned are active.

Let's wait for our second-tier supporters' response.

Regards,
Itamar.

2026-01-28_15-23-22.jpg
January 28, 2026 at 7:26 pm #17771715

sarahD-3

Yes, I look forward to it.

January 29, 2026 at 12:55 pm #17773615

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Our second-tier supporter has debugged this issue and found out that it is an internal server error triggered by the fact that the .htaccess is altered and /en/ is the rewrite base:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /en/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /en/index.php [L]
</IfModule>

Our second-tier supporter added that this happens primarily on the page /en/member-home/ and basically happens on every heartbeat. This happens when third-party plugins call the flush_rewrite_rules(true) function too often. Which leads to changes in the rewrite rules in your .htaccess file, which can cause issues on your WordPress site. The full explanation can be found here:
https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/.

I've implemented the workaround on your staging site. I've added the following function to the functions.php file of the 2025 theme.

add_filter('mod_rewrite_rules', 'fix_rewritebase');
function fix_rewritebase($rules){
    $home_root = parse_url(home_url());
    if ( isset( $home_root['path'] ) ) {
        $home_root = trailingslashit($home_root['path']);
    } else {
        $home_root = '/';
    }
  
    $wpml_root = parse_url(get_option('home'));
    if ( isset( $wpml_root['path'] ) ) {
        $wpml_root = trailingslashit($wpml_root['path']);
    } else {
        $wpml_root = '/';
    }
  
    $rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);
    $rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);
  
    return $rules;
}

After this, I visited the English version of your site, switched between multiple pages, and the problem did not occur again. Please proceed with the same to avoid this problem on your live site.

Regards,
Itamar.