Home›Support›English Support›[Resolved] Autotranslate is not translating the slug of custom post types in content links
[Resolved] Autotranslate is not translating the slug of custom post types in content links
This thread is resolved. Here is a description of the problem and solution.
Problem: The client was trying to use the auto-translate feature to translate their website's content, including custom post types like "building". They expected internal links to be fully translated, including the custom post type slugs. However, the slug for a specific custom post type was not being translated correctly in the links.
Solution: 1. The client resolved the issue by changing the "original" language of their custom post types to Spanish, which is the main language of their website. 2. They then reset the permalink structure, which resulted in the internal links being properly translated.
We also recommended: - Ensuring that linked pages are translated and published. - Editing and saving the original page with the links, then updating its translations. - Navigating to WPML > Settings and using the "Scan Now and adjust links" button in the "Translate Link Targets" area. - Updating WPML and String Translation plugins to the latest versions for bug fixes and enhancements.
If you're experiencing a similar issue and the solution provided here is not applicable or outdated, we recommend checking the related 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 with us.
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.
While waiting for an update on this issue I tried to run some tests on my end, which I would like to share with you in case they can help you and your team move forward with the investigation.
In you last message you mentioned "identified some issues with the code on the Single Post page". In order to test this I switched the site to a WP default theme, recreated my CPT (which are created by my theme) with a plugin, and attempted to translate some content.
The issue still persisted, so as far as I can tell, it is unrelated to the theme.
I hope this helps and I'll keep waiting for an update on your end.
One of our developers from our second-tier team has conducted an in-depth analysis of the problem and identified a potential workaround. This solution requires a few modifications, so please follow the provided steps closely and execute them in a staging environment or take a full backup of the site or database if you're trying them on your production site.
- Please go to: wp-content/themes/wikiarquitectura6/single-building.php
- Find the following line:
Note: You should find that line twice in the code, make sure to do the same for both lines.
- After that, Install and activate the "WPML Sticky Links" plugin on your site. You can download the plugin from your WPML Account(https://wpml.org/account/downloads/)
- Then, update the original post, which will allow you to convert the posts' links to IDs. Make sure that the link in the contents remains as: Walter Netsch
- After that, go to "wp-content/plugins/wpml-string-translation/classes/slug-translation/" and open the "class-wpml-slug-translation.php" file.
- Comment out the following line of code:
Note: you may notice some error messages due to commenting on the code. Please be informed that the error is expected as we commented out a function call.
- Update the translation of the post again and the links should appear correctly after that.
For your information, the internal ticket as also been escalated to the core development team for further investigation. Please try the workaround and let me know if that helps. We will be happy to help if you need further assistance in this matter.
Could you give the suggested workaround a try to see if it resolves the problem? Please feel free to let me know if you need further assistance in this matter. I will be happy to help.
I saw that message, but to be honest, and as much as I appreciate the time you and your team are putting into this, that hardly sounds like a solution... even as a workaround it seems to me like the risk of performing all those steps and messing something up are higher than the potential reward, which again would not be a solution, and I would still face the same problem whenever I translate more articles after that.
I understand I don't have the knowledge you and your team have about how your plugin works, but it stands out to me that you guys keep pointing to the theme as the problem, when to me the theme is just a way to layout and style the information. As far as I can tell all the translated content lives in the database, and should be properly translated there. How the theme could interfere with the translation process is something I don't fully understand. Plus, as I said in a previous message, I tried switching to a default WP theme and the translation problem still persists, so it's hard to believe the problem is related to the theme.
That's how I see the issue from my end, but of course any insight you can give me into why you guys think differently is greatly appreciated, I'm here to learn from you 🙂
Thank you for your honest feedback. I understand your concerns and appreciate your patience.
Regarding the theme, we realize it might not be the root cause, especially since the issue persists with a default WP theme. Our initial focus on the theme aimed to thoroughly investigate all potential variables, but based on your feedback, we are now adjusting our focus accordingly.
For a more straightforward approach, I suggest adjusting the sticky link plugin as outlined in my last response. Please also ensure that internal links are formatted correctly (e.g., `Walter Netsch`). This solution showed positive results in our tests and might work for your site as well.
Please ensure your site and database are fully backed up before making any changes. Your understanding is valuable to us and I also have forwarded your feedback to the team. We're here to assist every step of the way.
In case someone finds this thread in the future, this is what was going on.
I had declared my Custom Post Types in English, meaning I gave them an English name and an English slug.
As you can see in the image I attached to the first message of this thread, English was set as the "original" language for the CPT slugs in the WPML settings.
However, the main language of my website was set to Spanish.
I changed the "original" language of my CPT to Spanish, reset the permalink structure, and internal links are now properly translated.
Thank you Prosenjit and the rest of the WPML team for your assistance.
I'm glad to hear that you've successfully resolved the issue. The approach you've taken to solve the issue is certainly commendable and thank you for sharing the solution with the community! This will certainly help others who might encounter a similar problem.
I will also ensure to add the solution to the "Solution Box" right after you mark the ticket as resolved! 🙂
Feel free to reach us if you ever need any assistance with our plugins. We will be happy to help.
Once again, Thank you so much for sharing the solution and your kind cooperation throughout this matter.
Best regards,
Prosenjit
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.