Sauter la navigation

Ce sujet contient 0 réponse, a 1 voix.

Dernière mise à jour par nathanY Il y a 2 mois et 2 semaines.

Assisté par: Lucas Vidal de Andrade.

Auteur Articles
octobre 23, 2024 à 1:03 pm #16321930

nathanY

Background of the issue:
I am currently using WPML on my WordPress site, which includes a custom post type called products. My goal is to prevent specific product titles from being translated across the entire site. I have added the following code to my theme's functions.php file: get_var($wpdb->prepare("SELECT `field_data` FROM `wp_icl_translate` WHERE `field_type` = 'original_id' AND `job_id` = %d", $job_translate["job_id"])); // Check the post type $posttype = get_post_type($postid); // If the post type is 'products', exclude the title from translation if ($job_translate["field_type"] == "title" && $posttype == "products") { return false; // do not translate the title } // Default behavior return $is_translatable; } ?>

Symptoms:
Despite the above implementation, the product titles are still being translated by WPML, which is contrary to my requirements.

Questions:
Could you please assist me in troubleshooting this issue?
Are there alternative methods or settings that need to be configured to exclude product titles from being translated?