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 thread is resolved. Here is a description of the problem and solution.

Problem:Warning: Invalid argument supplied for foreach() error

Solution:please try whitelisting the following IPs that WPML is using.

https://api.wpml.org/ 74.50.57.24 http://d2salfytceyqoe.cloudfront.net/ 54.230.11.118 https://api.wp-types.com/ 52.200.8.253 http://d7j863fr5jhrr.cloudfront.net/ 54.230.11.56

Relevant Documentation:

This topic contains 4 replies, has 2 voices.

Last updated by claireS-6 5 months, 1 week ago.

Assigned support staff: Bobby.

Author Posts
May 7, 2019 at 8:05 pm #3761705

claireS-6

I am trying to:
Install WPML on a fresh local WordPress install. It did not work on my other install, but to eliminate any other possibilities, I am trying to set it up on a fresh install.

Info on this install:
PHP
Version 7.3.3
Memory limit 512M
Memory usage 37.67 MB
Max execution time 30
Max input vars 1000
Utf8mb4 charset Yes

WordPress
Version 5.1.1
Multisite No
Memory limit 256M
Max memory limit 512M

Link to a page where the issue can be seen:
This is a local instance, I am unable to link.

I expected to see:
The site running normally

Instead, I got:

Lots of "Warning: Invalid argument supplied for foreach()" errors, and then "Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wpml-test\wp-content\plugins\sitepress-multilingual-cms\vendor\otgs\installer\includes\class-wp-installer.php:677)"

May 7, 2019 at 9:04 pm #3762035

Bobby
Supporter

Languages: English (English )

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

Hi There

Usually warnings are not going to cause the site to crash or not work as optimal therefore If you want, it's possible to hide these messages settings WP_DEBUG to false, see: hidden link

However, it will be nice if we can take a look on what generated those warnings. In this case we will need more details.

What are your results if you remove the WPML plugin and install a fresh download from here
https://wpml.org/downloads/

additionally are you using any custom code within your wp-config.php file ?

May 8, 2019 at 2:18 pm #3767631

claireS-6

Thanks Bobby,

This site is in active development, so I'll need to have the php debug option active. WP_DEBUG has been set to false. I removed the old plugin and installed a fresh one, the second I activated it, I got the same errors. My wp-config doesn't have much beyond enabling more memory:

/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define( 'WP_DEBUG', false );
define('WP_MEMORY_LIMIT', '256M');
/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}

/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );

I am behind a proxy, I don't know if there's anything the plugin needs to connect to after registration that might be causing a problem.

May 8, 2019 at 5:53 pm #3769629

Bobby
Supporter

Languages: English (English )

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

Hello,

please try whitelisting the following IPs that WPML is using.

hidden link 74.50.57.24
hidden link 54.230.11.118
hidden link 52.200.8.253
hidden link 54.230.11.56

let me know your results please

May 13, 2019 at 6:36 pm #3801203

claireS-6

It turned out to be a proxy configuration issue, white-listing those IPs worked. Thanks!