Bỏ qua điều hướng

Open

Reported for: WPML SEO 2.1.0

Topic Tags: Compatibility

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:
    		return Obj::assoc(
    			'loc',
    			Obj::propOr(
    				$url['loc'],
    				(int) Obj::prop( 'ID', $object ),
    				$this->secondaryHomesById
    			),
    			$url
    		);
    
  • Add this code:
    		if (!is_array($url)){
    			$test = $url;
    			$url = array();
    			$url['loc'] = $test;
    		}
    

Để lại câu trả lời

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

Bạn có thể sử dụng các thẻ này:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>