marieN-4
Sitemap has mixed pages from default and translated pages.
- hidden link
- hidden link
And when WPML SEO is active along with Rank Math SEO, there's following critical error on English version of the sitemap:
Uncaught TypeError: Cannot access offset of type string on string
Stack trace:
#0 /wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php(36): WPML\WPSEO\RankMathSEO\Sitemap\Hooks->replaceHomePageInSecondaryLanguages()
#1 /wp-includes/class-wp-hook.php(324): WPML\WPSEO\RankMathSEO\Sitemap\Hooks->filterEntry()
#2 /wp-includes/plugin.php(256): WP_Hook->apply_filters()
#3 /wp-content/plugins/seo-by-rank-math/includes/traits/class-hooker.php(102): apply_filters_ref_array()
#4 /wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-posts.php(157): RankMath\Sitemap\Html\Posts->do_filter()
#5 /wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-posts.php(143): RankMath\Sitemap\Html\Posts->generate_posts_list_flat()
#6 /wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-posts.php(116): RankMath\Sitemap\Html\Posts->generate_posts_list()
#7 /wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-sitemap.php(133): RankMath\Sitemap\Html\Posts->generate_sitemap()
#8 /wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-sitemap.php(271): RankMath\Sitemap\Html\Sitemap->get_output()
#9 /wp-includes/shortcodes.php(433): RankMath\Sitemap\Html\Sitemap->shortcode()
#10 internal function: do_shortcode_tag()
#11 /wp-includes/shortcodes.php(273): preg_replace_callback()
#12 /wp-includes/class-wp-hook.php(324): do_shortcode()
#13 /wp-includes/plugin.php(205): WP_Hook->apply_filters()
#14 /wp-includes/post-template.php(256): apply_filters()
#15 /wp-content/themes/kadence/template-parts/content/entry_content.php(27): the_content()
#16 /wp-includes/template.php(792): require('/home/u92981353...')
#17 /wp-includes/template.php(725): load_template()
#18 /wp-includes/general-template.php(206): locate_template()
#19 /wp-content/themes/kadence/template-parts/content/single-entry.php(28): get_template_part()
#20 /wp-includes/template.php(792): require('/home/u92981353...')
#21 /wp-includes/template.php(725): load_template()
#22 /wp-includes/general-template.php(206): locate_template()
#23 /wp-content/themes/kadence/inc/template-functions/single-functions.php(27): get_template_part()
#24 /wp-includes/class-wp-hook.php(324): Kadence\single_content()
#25 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#26 /wp-includes/plugin.php(517): WP_Hook->do_action()
#27 /wp-content/themes/kadence/template-parts/content/single.php(34): do_action()
#28 /wp-includes/template.php(792): require('/home/u92981353...')
#29 /wp-includes/template.php(725): load_template()
#30 /wp-includes/general-template.php(206): locate_template()
#31 /wp-content/themes/kadence/inc/template-functions/single-functions.php(20): get_template_part()
#32 /wp-includes/class-wp-hook.php(324): Kadence\single_markup()
#33 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#34 /wp-includes/plugin.php(517): WP_Hook->do_action()
#35 /wp-content/themes/kadence/page.php(20): do_action()
#36 /wp-includes/template-loader.php(106): include('/home/u92981353...')
#37 /wp-blog-header.php(19): require_once('/home/u92981353...')
#38 /index.php(17): require('/home/u92981353...')
#39 {main} thrown in /wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php on line 69
Plugin: WPML SEO
File: /wp-content/plugins/wp-seo-multilingual/classes/RankMathSEO/Sitemap/Hooks.php
Line: 69
Long Nguyen
Supporter
Languages:
English (English )
Timezone:
Asia/Ho_Chi_Minh (GMT+07:00)
Hi Marie,
Thank you for contacting WPML support, I'd be happy to help you with this issue.
If you use the language URL format directories, it is expected to have all pages and their translations on the sitemap because there should be only one sitemap for your site.
Also don't worry about that because WPML already adds the hreflang to the page and tells the search engine about the translation.
Refer to this documentation
https://wpml.org/errata/different-sitemaps-per-language-while-using-wordpress-seo-by-yoast/
https://wpml.org/documentation/support/adding-hreflang-wordpress/
Regarding the error, please try to apply the workaround in the documentation below and see if it helps. Note: Please backup your database and website before proceeding.
https://wpml.org/errata/rank-math-seo-incorrect-url-in-sitemap-for-translated-front-page/
Look forward to your reply.
Thanks
marieN-4
Hello Long,
Thank you for explanation. It is OK now for me. We can close the tickets.
Best regards,
Marie