Resolved
Reported for: WPML SEO 2.2.1
Resolved in: WPML SEO 2.2.2
Overview of the issue
When using Rank Math PRO with WPML and WPML SEO and enabling the Video Sitemap feature, you might encounter the following fatal error on the video sitemap (video-sitemap.xml):
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in .../wp-content/plugins/wp-seo-multilingual/classes/Shared/Sitemap/BaseAlternateLangHooks.php:43
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open the …/wp-content/plugins/wp-seo-multilingual/classes/Shared/Sitemap/BaseAlternateLangHooks.php file.
- Look for line 43.
- Replace:
public function addAlternateLangDataToFirstLink( $link ) { $link[ self::KEY ] = []; - With:
public function addAlternateLangDataToFirstLink( $link ) { if ( ! is_array( $link ) ) { return $link; } $link[ self::KEY ] = [];