This thread is resolved. Here is a description of the problem and solution.
Problem:
Hidden languages were showing up in the AIOSEO sitemap
Solution:
The AIOSEO plugin author has included the fix of this issue in the 4.4.3 version.
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 31 replies, has 3 voices.
Last updated by Noman 1 year, 5 months ago.
Assisted by: Noman.
Author | Posts |
---|---|
February 7, 2023 at 9:55 am #12976077 | |
henningV-2 |
hi- my hidden languages are showing up in the AIOSEO sitemap. Only English should appear. I have WPML SEO plugin installed. |
February 7, 2023 at 5:27 pm #12981451 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
I have reproduced this issue at fresh WP site and I have escalated it to our 2nd tier support for further review and I will update you as soon as I hear back. Thank you for your cooperation and patience. |
February 10, 2023 at 8:11 pm #13009693 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Yes sure I would be happy to help. I will only work on this particular file to add the fix and will not touch anything else in your site: 1. === Please create a Full backup of your website === 2. Please provide temporary access (WP-Admin and FTP Login info) to your site. Your next answer will be private which means only you and I have access to it. Thank you, have a great weekend. |
February 13, 2023 at 4:50 pm #13023215 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
I have applied the fix to your site in the same way as I did at the fresh WP site but it doesn’t solve the issue on your site. I suspect this might be due to some possible theme/plugin conflict on your site. To troubleshoot this issue without affecting your live site, I have set up a fresh WP site on cloudways. Can you please migrate your site to the cloudways server so that we can see if it’s a theme/plugin conflict or a server-specific issue? I have shared the migration details in the next private reply. Thank you |
February 14, 2023 at 3:40 am #13025715 | |
henningV-2 |
Hi Noman - I made a staging server you can login in to here: hidden link You'll see that I have the default WP theme and only AISEO and WPML plugins activated and the issue remains. You may make changes to this staging server to diagnose the issue. If they work we can push it live. |
February 14, 2023 at 3:43 pm #13032425 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
I have deactivated and re-activated the AISEO plugin and the issue is gone: hidden link Could you please check and confirm? Thank you for your cooperation and patience |
February 15, 2023 at 4:21 am #13035245 | |
henningV-2 |
Thanks! That is an improvement! But there is still something not right. I would expect to see only one link for each page and for it to be English. What I see are 3 links for each page (representing Eng (live) Chi Simp (hidden) Chi Trad (hidden). See attached. |
February 15, 2023 at 12:02 pm #13039685 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
I got your point. I have informed 2nd tier about this for further fixes, will update you when I have a news. Thank you |
February 20, 2023 at 4:55 am #13066483 | |
henningV-2 |
Hi Noman - FYI now the sitemap is back to showing the hidden languages. What can we do to hurry up this fix as I don't want it to effect our Google crawling. |
February 20, 2023 at 1:08 pm #13069899 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Reset of code might be because AIOSEO plugin updated automatically. If this happens it will override the code that we have changed in the plugin files as a temporary workaround. So you would need to re-add that until there is a fix and disable automatic update for AIOSEO. I have again asked our 2nd tier if there is a better workaround for it. I will let you know as soon as I hear back. thank you |
February 23, 2023 at 3:57 pm #13101591 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Could you please take a backup of your site and follow the below steps: 1. Please make sure to download and install the latest version of the AIOSEO plugin so that it will remove the previous changes. 2. Go to: wp-content/plugins/all-in-one-seo-pack/app/Common/Sitemap/Localization.php file. 2.1. Replace the below code: public function localizeEntry( $entry, $entryId, $objectName, $objectType ) { $translationGroupId = apply_filters( 'wpml_element_trid', null, $entryId ); $translations = apply_filters( 'wpml_get_element_translations', null, $translationGroupId, $objectName ); With: public function localizeEntry( $entry, $entryId, $objectName, $objectType ) { $translationGroupId = apply_filters( 'wpml_element_trid', null, $entryId ); $translations = apply_filters( 'wpml_get_element_translations', null, $translationGroupId, $objectName ); $hiddenLanguages = apply_filters( 'wpml_setting', [], 'hidden_languages' ); foreach ($hiddenLanguages as $language){ if ($translations[$language]) { unset ($translations[$language]); } } 3. Go to: wp-content/plugins/all-in-one-seo-pack/app/Common/Sitemap/Query.php file. 3.1. Replace the below code: public function posts( $postTypes, $additionalArgs = [] ) { With: public function posts( $postTypes, $additionalArgs = [] ) { global $wpdb; 3.2. Replace the below code: $excludedPosts = aioseo()->sitemap->helpers->excludedPosts(); With: $excludedPosts = aioseo()->sitemap->helpers->excludedPosts(); $hiddenLanguages = apply_filters( 'wpml_setting', [], 'hidden_languages' ); foreach ($hiddenLanguages as $langage){ $excludedPosts .= implode(',',$wpdb->get_col("SELECT `element_id` FROM `{$wpdb->prefix}icl_translations` WHERE `element_type` = 'post_$postTypes' AND `language_code` LIKE '$langage'")); } I have just tested at the fresh WP site and it seems to be working correctly as you can see on this page: You may copy the updated code from the above site. Here is the auto login URL of that fresh WP site: hidden link If you find any issues in applying these changes to your site, please let me know and I’ll be happy to apply these changes to your site. Please let me know if this resolves your issue or if you need further assistance. Thank you for your cooperation and patience |
February 24, 2023 at 6:23 am #13105079 | |
henningV-2 |
Hi Noman - we have AISEO Version 4.3.1.1 and I've copied the code from your sandbox and still see lots of the hidden languages at hidden link. Either showing as a duplicate page or the portfolio categories. Please note I've just made the Traditional Chinese public so it's appearing in the sitemap. |
February 26, 2023 at 9:56 am #13116117 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Sorry for the delay, it was my weekend (Friday-Saturday). I have tried to reproduce this issue at your test site by following the below steps: 1. Deleted the existing AIOSEO plugin. It seems it's working correctly at your site as you can see in this link: Please let me know if I missed something or please make sure you have followed the same steps on your live site as I shared above. Looking forward, |
February 27, 2023 at 5:23 am #13119329 | |
henningV-2 |
Hi Noman - no it isn't right. When you allow portfolio and portfolio categories in the sitemap then you get the same results as at hidden link - lots of incorrect duplicates and Simp Chinese portfolio stuff showing. |
February 28, 2023 at 2:50 am #13130565 | |
Noman Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
It turns out that this compatibility issue is more complex than we initially thought. We identified that its a problem in AIOSEO plugin code so we will need their developers to provide to the actual code fix for this issue. We tried to provide a workaround which is not an actual fix that is why we are facing these odd issues with Custom post types etc. In the meantime we suggest to Remove any language from WPML settings that you do not need, to avoid it to be shown in sitemap - the languages that you are currently hiding. I have informed our compatibility team with latest results and they will be working out with the AIOSEO developers to offer a better fix for this issue but it will take time as this depends on how fast AIOSEO team responds to our requests & provides the actual fix in their plugin. Thanks |