This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with unwanted translations of your shop page appearing in your sitemap, even though they don't exist in the Page menu, we have a workaround for you.
Solution:
Please follow these steps:
1. Open the
/wp-content/plugins/wp-seo-multilingual/classes/class-wpml-wpseo-xml-sitemaps-filter.php
file.
2. Locate line 152.
3. Replace the existing code at that line with the following:
case 'product': $this->sitepress->switch_lang( $lang_code ); $shop_page_id = get_option('woocommerce_shop_page_id'); $url = get_permalink($shop_page_id); $this->sitepress->switch_lang(); break; default: $this->sitepress->switch_lang( $lang_code ); $url = get_post_type_archive_link( $type ); $this->sitepress->switch_lang();
After applying these changes, please check your product sitemap to see if the issue is resolved.
Please note that this is a temporary workaround and for WooCommerce Multilingual (WCML) to function properly, it's recommended to translate the shop pages.
If this solution does not apply to your case, or if it's outdated, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, 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: Compatibility
This topic contains 14 replies, has 2 voices.
Last updated by Osama Mersal 1 year, 5 months ago.
Assisted by: Osama Mersal.
Author | Posts |
---|---|
January 13, 2024 at 1:46 pm #15181395 | |
nickF-8 |
Hi, I used WPML to translate my site, but I did not want to translate my shop page. However, now I have 3 translations of my shop page (www.HellenicMoon.com/shop). These translations show up in my sitemap but I cannot find how to remove them, as they dont actually exist as pages in the Page menu! The 3 pages I would like to unpublish are: hidden link any ideas? |
January 14, 2024 at 12:13 pm #15182266 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, Thanks for contacting WPML forums support. I'll be glad to help you today. If you can see the pages in the Pages-> All pages, please go to WPML-> Settings-> Post Type Translation, and set the Pages post type to "Translatable - Show only translated items". However, it would be best if you had translated pages for WooCommerce pages. Please check our WooCommerce Multilingual guide. (https://wpml.org/documentation/related-projects/woocommerce-multilingual/) Best regards, |
January 15, 2024 at 1:53 pm #15185587 | |
nickF-8 |
Hi Osama, Thanks that seemed interesting but it didnt work. I set page type to only show translated items, but all 3 translated shop pages are still online. This is a problem for me as they are showing up in the sitemap and causing SEO problems. I did download the WooCommerce multilingual extension and activated it, but did not set it up, because I do NOT want to translate my product pages, but I DO want the products to show up on translated pages, so I have to have the plugin active. When I disactivated the plugin the products disappeared from translated pages. This problem with the SHOP page is a bit special, because I think it started when originally I DID translate the shop pages, but have long since deleted them from the page view, (see shop page.png). In the screenshot you will see the Shop page is NOT translated! On top of that, if I go to one of the translated shop pages (see Shop translations.png), the menu at the top does NOT have the normal EDIT link like other pages (which is what I was hoping for to unpublish the page and put it back to draft). So I am stuck with these weird pages and no way to unpublish them and get them off my SiteMap! Any ideas? |
January 15, 2024 at 6:28 pm #15186526 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, 1) Thanks for your update. The language switcher doesn't work when visiting the shop page, so the page is not translated. 2) You can translate the page and set the translated pages as private, so your site's viewers won't be able to see it even if they typed the URL. Alternatively, you can create a redirection for the translated URLs to the default language shop page. Best regards, |
January 16, 2024 at 1:04 pm #15189834 | |
nickF-8 |
Hi, I tried that but it didnt work. I translated the shop page to Italian, set it to private, and the next time it refreshed it was public again. The Woocommerce WPML plugin must be forcing it. I also just set it to not show on the sitemap using Yoast settings, but again, it stays on the sitemap! All I want to do is take it off the sitemap as you can see the 3 links here at the end of the page: hidden link I installed the Woocommerce multilingual plugin, but never went past the setup screen. And apart from this issue with the store page, I am ok with my woocommerce setup as it is (it is only in English but thanks to the plugin it shows the English in all the languages). If I setup the plugin properly will it allow me to unpublish the store pages? I am worried if I start setuping up the plugin it will start setting up all kinds of stuff that I dont want, and forcing new translated pages into the store, when I dont want any more right now. |
January 16, 2024 at 1:24 pm #15189922 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, Thanks for your update. Please delete the translated pages from the pages list and the trash. After that, please consult Yoast support regarding the site map, as the pages are not in the database. Also, not completing the setup is incorrect because the plugin doesn't function properly. I created a test sandbox site to replicate the issue. Please login to the sandbox and try to reproduce the same issue. (hidden link) If the issue is replicable, please let me know how to reproduce it. Best regards, |
January 16, 2024 at 1:51 pm #15190347 | |
nickF-8 |
I tried to replicate the error and came close but its not exactly the same. To be exactly the same it would have to show the extra shop pages on the Product Sitemap: hidden link But instead, I managed to get them to show on the Page Sitemap: hidden link But as soon as you delete one of the translated pages, it is gone from the Page sitemap. Is this enough to help you start looking into it? Also, I looked into finishing the woocommerce setup and I had to stop because it is telling me it will create a whole bunch of new pages, which is exactly what I dont want. |
January 16, 2024 at 2:03 pm #15190481 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, Thanks for trying to replicate the issue. On the sandbox site, the pages are deleted when deleting the pages, which is the expected behavior. Could you please check if the issue persists in a minimal environment by following these steps? 1- Deactivate all the plugins except those active ones on the sandbox site. If the issue is gone, activate them one by one to see which one is causing an interaction issue. ❌ Please backup your database before performing the above test ❌ Best regards, |
January 22, 2024 at 2:33 pm #15212135 | |
nickF-8 |
Hi Osama, I ran some tests on a staging version of my blog, and I discovered that the 3 pages disappear from the product sitemap if I disable the WPML SEO plugin. And when I reenable it, they reappear. Is WPML SEO optimized for working with Yoast SEO plugin for wordpress? Thats probably why you dont see the error in your staging site, you need to enable WPML SEO Plugin as well |
January 22, 2024 at 2:48 pm #15212245 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, Thanks for your update. I've consulted our compatibility team to check whether that is an expected behavior. I'll update you as soon as I get their reply. Best regards, |
January 22, 2024 at 3:33 pm #15212549 | |
nickF-8 |
Thanks, I also have an update for our older ticket "Problems with Yoast Breadcrumbs on Hestia Pro theme by Themeisle". I did the tests for that problem at the same time when I disabled all the plugins, and yet, even after I disabled all plugins and resaved the Yoast and Reading settings, the /blog was still not showing in the Breadcrumbs. Any ideas? |
January 22, 2024 at 3:49 pm #15212654 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, 1) I'm afraid I don't have more ideas, as the blog breadcrumbs worked correctly on the sandbox site. Also, I tested it on the new sandbox site, and it works correctly. (hidden link) 2) Let us focus on this ticket on the sitemap issue, and please open a new ticket for the old issue. We try to keep one issue per ticket in our forum. Continuing with one ticket per issue helps supporters focus on one issue at once and enables other users to find solutions to their questions faster. Best regards, |
January 29, 2024 at 10:09 am #15237204 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, Thanks for your patience. Our compatibility team has found a workaround for the issue. Please check the following steps: 1- Open the (/wp-content/plugins/wp-seo-multilingual/classes/class-wpml-wpseo-xml-sitemaps-filter.php) file default: $this->sitepress->switch_lang( $lang_code ); $url = get_post_type_archive_link( $type ); $this->sitepress->switch_lang(); With case 'product': $this->sitepress->switch_lang( $lang_code ); $shop_page_id = get_option('woocommerce_shop_page_id'); $url = get_permalink($shop_page_id); $this->sitepress->switch_lang(); break; default: $this->sitepress->switch_lang( $lang_code ); $url = get_post_type_archive_link( $type ); $this->sitepress->switch_lang( ); After that, please check the product sitemap. I've applied the above steps to the sandbox site. Please check if the sitemap works correctly. (hidden link) Note: The shop page is repeated but without the language directory. That happens because the shop page is not translated. Once it is, it shows the correct URL. Kindly remember that this is just a workaround, and shop pages should be translated for WCML to work correctly. Best regards, |
January 30, 2024 at 10:53 am #15242718 | |
nickF-8 |
Thanks Osama, I will give it a try. The thing that I did not understand is that even if I did translate the pages and then told Yoast SEO to not include the translated pages in the sitemap (which was the first thing we tried), it would always get overridden and then show the pages in the sitemap. So if I do translate them, I will have to have them in my sitemap! |
January 30, 2024 at 10:58 am #15242809 | |
Osama Mersal WPML Supporter since 02/2020
Languages: English (English ) Arabic (العربية ) Timezone: Africa/Cairo (GMT+03:00) |
Hi, Thanks for your reply. You will see the correct translated pages on the site map if you have translated them. Our dev team is aware of the issue and will debug it further for a permanent fix. Best regards, |