Skip to content Skip to sidebar

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

Problem:
You are encountering a PHP warning related to the WPML plugin, specifically an 'Undefined array key "REQUEST_METHOD"' error. This issue occurs in non-browser contexts such as WP-CLI commands, scheduled cron jobs, or when custom code triggers certain WPML functions outside of a normal page load.
Solution:
To address this issue temporarily, you can modify your custom code to set the 'REQUEST_METHOD' in the $_SERVER superglobal before WPML functions are called. Here is how you can do it:

<?php<br />$_SERVER['REQUEST_METHOD'] = 'GET';<br /><br />// ... rest of the script.

We have already reported this issue to our developers, and a fix will be included in future versions of the plugin.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.

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 3 replies, has 1 voice.

Last updated by vadimP 4 months, 1 week ago.

Assisted by: Dražen.

Author Posts
August 13, 2025 at 7:48 am #17315864

vadimP

Background of the issue:
I am trying to resolve a PHP warning related to the WPML plugin on my site hidden link. The warning appears in the file /var/www/vhosts/e-laimalux.lv/httpdocs/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/class-wpml-pb-integration.php on line 170.

Symptoms:
PHP Warning: Undefined array key "REQUEST_METHOD"

Questions:
Is there anything we can do to solve this PHP warning?

August 13, 2025 at 10:13 pm #17319280

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

While one of my teammates works on your ticket, I’d like to ask you a few questions.

Could you please share more details about which pages are showing these warnings and what specific actions lead to them appearing?

August 14, 2025 at 9:24 am #17320276

vadimP

Hey Andrey, its hard to say. We are getting those errors in the log, so its hard to say what exactly is happening on the site when this happens

August 18, 2025 at 6:51 am #17326198

Dražen
Supporter

Languages: English (English )

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

Hello,

I checked further the code and warning, and it seems it appears when WordPress code tries to read $_SERVER['REQUEST_METHOD'] (which normally exists during a browser request), but it’s not available. This typically happens in non-browser contexts such as WP-CLI commands, scheduled cron jobs, or when custom code triggers certain WPML functions outside of a normal page load.

The warning is coming from WPML’s page-builder integration class. WPML assumes it’s running during a regular HTTP request. If custom theme or plugin code calls WPML functions during CLI or cron runs, that assumption no longer holds, and the PHP notice is triggered.

Workaround for your custom code triggering this error:

<?php
$_SERVER['REQUEST_METHOD'] = 'GET';

// ... rest of the script.

The issue is already reported and escalated to our devs and will be fixed in the future versions.

If there is anything else we can do for you, please let us know.

Best regards,
Dražen

August 18, 2025 at 2:44 pm #17328282

vadimP

Thank you!