Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing a fatal error on the Thai page when using the RankMath HTML sitemap feature. The error message indicates an issue with accessing an offset of type string on a string in the file

/wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php

.
Solution:https://wpml.org/forums/topic/incompatible-with-rankmath-html-sitemap-fatal-error/#post-15710148

Please note that this solution might be irrelevant if it's outdated or not applicable to your 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 problem persists, please open a new support ticket.

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.

Tagged: 

This topic contains 1 replies, has 2 voices.

Last updated by Shekhar Bhandari 1 year, 2 months ago.

Assisted by: Shekhar Bhandari.

Author Posts
June 6, 2024 at 5:38 am

myoW

Background of the issue:
I'm trying to add the HTML sitemap feature of RankMath (hidden link). Once the feature was enabled, a shortcode was given to add to the page I wanted to display the HTML sitemap. The English page works fine (hidden link). The Thai page (hidden link) throws a fatal error.

Symptoms:
The Thai page throws a fatal error: [06-Jun-2024, 05:20:27 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/htdocs/wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php:69

Questions:
Why does the Thai page throw a fatal error when using the RankMath HTML sitemap feature?
How can I resolve the fatal error on the Thai page?

June 6, 2024 at 7:13 am
June 6, 2024 at 10:03 am #15710148

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Our 2nd tier checked thee issue and provided the following workarround:

- Go to wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php

Add the following

if (!is_array($url)){
			$test = $url;
			$url = array();
			$url['loc'] = $test;
		}

Above

return Obj::assoc(
			'loc',
			Obj::propOr(
				$url['loc'],
				(int) Obj::prop( 'ID', $object ),
				$this->secondaryHomesById
			),
			$url
		);

Also the issue is escalated to our developers for a permanent solution.

Let me know if this helps.

Thanks