Open
Reported for: WPML SEO 2.1.0
Overview of the issue
A fatal error occurs when using the HTML sitemap feature from the Rank Math SEO plugin via a shortcode, [rank_math_html_sitemap]
.
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in .../wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php on line 69
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Edit …/wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php file.
- Just before line 66:
123456789
return
Obj::assoc(
'loc'
,
Obj::propOr(
$url
[
'loc'
],
(int) Obj::prop(
'ID'
,
$object
),
$this
->secondaryHomesById
),
$url
);
- Add this code:
12345
if
(!
is_array
(
$url
)){
$test
=
$url
;
$url
=
array
();
$url
[
'loc'
] =
$test
;
}