Problem: You want to translate the JavaScript and PHP files on your website. Solution: To make text in these files translatable, you need to register the strings with WordPress' localization functions. Here's how:
For PHP files: Wrap any user-facing text in WordPress i18n functions such as
__()
or
_e()
with your theme or plugin text domain. For example:
echo __( 'Your text here', 'theme-textdomain' );
For JavaScript files: Text hardcoded in JavaScript files cannot be translated automatically. Instead, pass strings from PHP to JavaScript using functions like
After registering, you can find these strings in WPML → String Translation, where you can provide translations for each language.
If you need further assistance or if this solution does not apply to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket.
Problem: The client has created a language landing page and wants the website to remember the user's language choice using cookies, so it doesn't prompt for language selection on subsequent visits. Solution: We recommend the following steps: 1. Ensure that the 'Language filtering for AJAX operations' is enabled in WPML under WPML >> Languages. This setting allows WPML to set the language code in the cookie 'wp-wpml_current_language'. 2. Use a PHP if/else statement to read this cookie and redirect the user to the correct language page based on their previous selection. For more details on handling cookies with WPML, please refer to our documentation: https://wpml.org/documentation/support/browser-cookies-stored-wpml/ https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/
Please note that this solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If this does not resolve your issue, please open a new support ticket at https://wpml.org/forums/.
Problem: The client is experiencing issues with automatic translations in WPML where the title and content remain empty. Additionally, when trying to refresh an individual post from the WPML translation editor, the page fails to load and displays a PHP Fatal error related to a 'Division by zero' in the WPML plugin files. There are also PHP warnings indicating 'Undefined array key "post_title"'. Solution: We recommend checking for any custom code that might be interfering with the WPML functionalities, especially those related to post titles in translations. It's important to ensure that all custom code snippets are correctly adjusted to match the specific custom post types used on your site. For further guidance on managing translation settings for custom post types, you can refer to this documentation: https://wpml.org/forums/topic/remove-title-from-translation-only-for-custom-post-type/#post-15269091.
If these steps do not resolve the issue, or if the solution seems outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If problems persist, please open a new support ticket with us for personalized assistance.
Problem: The client reported issues with automatic translations not detecting HTML fields in product category descriptions and some descriptions not being translated at all. Additionally, there were problems with the HTML structure not being respected in translations, which is crucial for SEO, and issues with Yoast SEO term meta not appearing translated in the frontend.
Solution: 1. To address the HTML tags issue in product category descriptions: - Edit the file
- In WPML settings, disable the option "Don't show translated taxonomies in Translation Editor" to allow translation of category descriptions directly in the Advanced Translation Editor and retranslate the products. 2. Alternatively, translate the product category manually via WPML > Taxonomy Translation. 3. For translating Yoast SEO term meta, ensure to send the term meta for translation from WPML > Translation Dashboard as detailed in our documentation here. 4. To resolve issues with the same slug across languages, enable the option "Adjust IDs for multilingual functionality" in WPML > Languages > Section Make themes work multilingual.
If these solutions do not resolve your issue or seem outdated, we recommend opening a new support ticket. Additionally, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, please visit our support forum at WPML support forum.
Problem: The client is experiencing an issue where after switching from the Linguise language plugin to WPML, the URL slug for Portuguese changed from 'pt' to 'pt-pt', and they want to revert it back to the original 'pt' slug. Solution: If you're experiencing this issue, we recommend creating a custom language in WPML where you can specify the desired language code. Here's how you can do it: 1. Go to WPML > Languages. 2. Under 'Edit Languages', click on 'Add languages'. 3. Enter the language name, code (in this case, 'pt'), and other details. 4. Save your changes. This should help you set the URL slug to your preferred format.
Please note that this solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum for further assistance.
Problem: Клиент столкнулся с проблемой синхронизации остатков товаров в WooCommerce при использовании WPML и обновлении stock через внешний источник. Остатки корректно обновляются только у товара на основном языке, в то время как переводы товара не получают обновление _stock и _stock_status и остаются со статусом «Нет в наличии». Solution: Мы объяснили, что WPML не может автоматически определить обновление остатков через внешний источник. Для ручной синхронизации остатков можно использовать панель управления WordPress: WooCommerce → WPML Multilingual & Multicurrency for WooCommerce → Status → Troubleshooting и выбрать опцию “Synchronize stock for products and product variations”. Для программной синхронизации можно использовать хуки WPML:
для синхронизации конкретного поля или wpml_sync_all_custom_fields для синхронизации всех пользовательских полей конкретного товара.
Если данное решение не актуально или не помогает в вашем случае, рекомендуем открыть новый тикет в службе поддержки WPML. Также рекомендуем проверить известные проблемы, версию постоянного исправления и убедиться, что у вас установлены последние версии тем и плагинов.
Problem: The client is using WCML and has encountered an issue where Google Merchant Center is not compatible with geolocation for currencies, leading to a blockage of all products due to price mismatches. The client needs a solution to send products with different currencies to Google Merchant Center, each with a unique URL. Solution: We recommended a custom implementation using WCML hooks for multi-currency, which involves detecting a URL parameter and dynamically setting the currency. Specifically, the client can override WCML's currency selection by using a URL parameter (e.g.,
?wcmlc=USD
). This approach requires adding custom code to check for the URL parameter and conditionally override the default currency behavior. We suggested using the
wcml_client_currency
filter or a similar hook for this purpose. Additionally, we advised against using geolocation for this specific use case as it conflicts with Google Merchant Center requirements.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.
Problem: You've created custom Gutenberg blocks and are facing issues with the translation of the title field in your 'Text Image Item' block. While the title translates correctly in the editor, it does not translate on the frontend and remains in German. Solution: We recommend updating your WPML configuration for the custom blocks. Here is the correct XML code you should use:
Add this code in WPML -> Settings -> Custom XML Configuration by replacing the current code for this Text Image block that does not work. Additionally, consider using our Multilingual Tools plugin to generate WPML configurations. For more information, please visit https://wpml.org/documentation/support/multilingual-tools/.
If this solution does not resolve your issue or seems outdated, please check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. We highly recommend opening a new support ticket for further assistance at https://wpml.org/forums/forum/english-support/.
Problem: You have a custom taxonomy called 'fitment' assigned to WooCommerce products, set as Not Translatable in WPML. Terms are created in Polish and work correctly in Polish products, but in the English product edit screen, the taxonomy is visible without any terms to select. You want the same taxonomy terms to be shared across all languages without needing translations.
Solution: The issue might be related to the
meta_box_cb => 'post_categories_meta_box'
in your custom code. This meta box forces WordPress to render the classic Categories-style checklist metabox for this taxonomy, which relies on wp_terms_checklist() → get_terms(), and WPML filters get_terms() in wp-admin to the current admin language. If your Fitment terms are created only in the default language and don’t have term translations, the checklist in the secondary language can appear empty. To resolve this: 1. Remove the
meta_box_cb => 'post_categories_meta_box'
from your custom code to test if the terms show in the translation without it. 2. Register the taxonomy on init with priority 0 to avoid issues with it being registered too late.
If these steps do not resolve the issue, or if the solution becomes outdated, we highly recommend checking related known issues at https://wpml.org/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.