Skip to content Skip to sidebar

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

Problem:
The client is experiencing an issue where the

$_POST

variable returns empty when the WPML plugin is active. This problem occurs because the 'action' parameter of the form includes a language parameter (?lang=en), causing a redirect that fails to forward the form data to the intended destination.
Solution:
We recommend removing the language parameter from the 'action' URL if the default language is English, as this will prevent unnecessary redirects. For handling multiple languages, consider setting up the 'Different languages in directories' option available in WPML -> Languages. This setup helps manage language-specific URLs more effectively. Before making changes, ensure to back up your website and database, and if possible, test these changes on a staging site first.

If this solution does not resolve your issue or seems outdated, please check the related known issues and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket for further assistance.

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 1 reply, has 0 voices.

Last updated by Waqas Bin Hasan 1 month, 1 week ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 27, 2025 at 9:31 pm #17353004

Josh Warren-White

Background of the issue:
I am trying to make sure a custom-built form in a page with a custom template that posts the submitted data to the expected page. The form is located at hidden link and upon submission, it should send the form data to this page - hidden link.

Symptoms:
The $_POST variable always returns empty. However, when I turn off the WPML plugin, the form behaves as expected. This was a recent issue as I had been testing this custom form on the staging site within the last couple of weeks with no issues and nothing was changed.

Questions:
Why does the $_POST variable return empty when WPML is active?
What changes in WPML could affect form data submission?

August 28, 2025 at 1:06 pm #17355177

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

Please note that support for custom coding is out of scope of this forum, however, I analyzed the form on your given URL and I see the "action" parameter of form is set to hidden link (notice the ?lang=en at end of the URL).

This is causing a redirect (302) which is receiving form data but upon redirection, not forwarding it to /your-guide/ destination.

However, if you remove that ?lang=en from the URL, there's no redirect and form data reaches the destination.

Since you're default language is English, you shouldn't add a language parameter to it. However, the same can create a pitfall for translated languages (i.e. Spanish).

On the other hand, I see that you perhaps are hardcoding this language parameter in your code, because on Spanish form the action refers to hidden link (notice ?lang=es twice, one seems hard coded while other is being added by WPML in the switcher). I may be wrong but the action URL for translated one is surely wrong.

I'll recommend using "Different languages in directories" for Language URL Format in WPML -> Languages for a better approach to deal with such scenarios.

IMPORTANT: Please take full backup of your website and database beforehand. 

It is highly advised to try this on a staging/dev site first, so your live website isn't compromised.

Regards.

Screenshot 2025-08-28 175832.jpg
Screenshot 2025-08-28 175748.jpg
Screenshot 2025-08-28 175648.jpg
Screenshot 2025-08-28 175631.jpg
Screenshot 2025-08-28 175543.jpg
Screenshot 2025-08-28 175451.jpg
Screenshot 2025-08-28 175340.jpg