Problem: You are encountering a PHP error 'Undefined array key 4' in the WPML Media Translation plugin. This error occurs because the array keys are filtered out, making the array have non-consecutive keys. This issue is present in the file wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php at lines 99 and 163. Solution: We recommend modifying the code to handle arrays with non-consecutive keys correctly. Instead of using a for loop, switch to a foreach loop. Here is the corrected code:
Please note that this solution might be outdated or not applicable to your specific 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 the issue persists, please open a new support ticket.