Problem: The client wants the language switcher in the nav bar to display the name of the other language instead of the active language. The site uses Gutenberg blocks, and the switcher currently shows only two letters representing the active language (German), but the client wants it to display the name of the other language (French). Solution: We recommend two methods to achieve this: Method 1: Hide the current language using CSS 1. Edit the Language Switcher block. 2. Set the "Layout" to list. 3. Add the following CSS in the custom CSS section of the theme:
Method 2: Add language switcher using shortcode 1. Go to the WPML >> Languages page. 2. Enable the Custom Language Switcher. 3. Replace the language switcher block with a shortcode block and use the following shortcode:
If these solutions do not resolve your issue or if they seem 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.
Problem: You are using WP-CLI to list all media IDs in the trash across all languages but the command only returns media IDs for the main language. Solution: We have identified two potential workarounds to include media IDs from all languages: 1) Use the WP-CLI parameter
--suppress_filters=true
which allows the command to work across all languages. 2) Use the parameter
--url="https://yourwebsite.com/en"
to force WP-CLI to work in the language based on the URL.
Additionally, our 2nd Tier Support suggests modifying the code in
function with the following code to include a condition that checks for the 'lang' parameter in the query:
public function posts_where_filter( $where, $query ) {
if ( $query === null || $this->where_filter_active( $query ) === false ) {
return $where;
}
$requested_id = isset( $_REQUEST['attachment_id'] ) && $_REQUEST['attachment_id'] ? $_REQUEST['attachment_id'] : false;
$requested_id = isset( $_REQUEST['post_id'] ) && $_REQUEST['post_id'] ? $_REQUEST['post_id'] : $requested_id;
$requested_id = (int) $requested_id;
$default_language = $this->sitepress->get_default_language();
$post_language = $this->post_translations->get_element_lang_code( $requested_id );
if (isset($query->query["lang"])) {
$post_language = $query->query["lang"];
$requested_id = "1"; //hack needed because then $current_language will not get the $post_language, but will call for get_current_language
}
$current_language = $requested_id && $post_language ? $post_language : $this->sitepress->get_current_language();
$condition = $current_language === 'all' ? $this->all_langs_where() : $this->specific_lang_where( $current_language, $default_language );
$where .= $condition;
return $where;
}
Please note that this solution might be outdated or not applicable to your specific 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 these solutions do not resolve your issue, please open a new support ticket at WPML support forum.
Problem: You have created a custom post type (CPT) with the slug 'event' using the ACF Pro plugin and defined a custom archive slug 'events'. You have translated the base default slug 'event' to 'événement' in French via WPML > Settings > Post Types Translation, but you are unable to find where to translate the archive slug. Solution: Currently, WPML does not support the translation of custom slugs set in the
has_archive
option for custom post types. You can read more about this limitation here. We recommend enabling the archive option and leaving the slug field empty for custom post types created with ACF. This approach uses the default slug, and when you switch languages, the translated slug set in "WPML > Settings > Post Type Translation" will display.
If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please open a new support ticket at WPML support forum.
Problem: The client needed a way to customize the ALT text for flag images in the WPML language switcher to improve accessibility and comply with WCAG 1.1.1, without modifying WPML core files. Solution: We advised the client that currently, the best approach to achieve the desired ALT text customization is to follow the workaround provided in our errata, which involves modifying the 'class-wpml-ls-model-build.php' file.
Unfortunately, there are no suitable hooks or filters available for this customization, and implementing custom code would be complex. We also informed the client that there is no ETA for a permanent fix but have taken their feedback as a feature request. We recommended trying the workaround after ensuring a site backup.
Please note that this solution might be outdated or not applicable to your specific 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 WPML support forum.
Problema: Stai utilizzando l'API REST di WooCommerce per tradurre le categorie di prodotti sul tuo sito. Quando tenti di tradurre una sottocategoria, la traduzione funziona, ma non è collegata alla categoria principale tradotta. Ti chiedi se 'translation_of' sia il parametro corretto da usare nella chiamata API per collegare la traduzione alla categoria principale. Soluzione: Al momento non esiste un modo per sincronizzare le gerarchie delle categorie tradotte programmaticamente tramite l'API. Tuttavia, puoi esplorare la classe
e scrivere del codice personalizzato per gestire questa sincronizzazione. Se necessiti di assistenza nello sviluppo, ti consigliamo di consultare uno dei nostri contractor. Se questa soluzione non risulta pertinente, potrebbe essere perché è obsoleta o non applicabile al tuo caso. Ti consigliamo di verificare i problemi noti, controllare la versione della correzione permanente e confermare di avere installato le ultime versioni dei temi e dei plugin. Se il problema persiste, ti invitiamo a aprire un nuovo ticket di supporto.