Fix _Invalid argument supplied for foreach()_ notice for WPML

as reported by [pbearne](https://github.com/pbearne) in issue #369