Skip Navigation

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.

This topic contains 2 replies, has 2 voices.

Last updated by Lauren 1 year, 9 months ago.

Assisted by: Lauren.

Author Posts
January 18, 2023 at 7:49 pm #12846051

George K

we have a Woocommerce website with a few thousand products. We are interested to automatically translate all products, but we want to exclude product titles. I have seen that there is no option for this. Do you have any function or script, which can exclude product names from translation?

Solution: We do not have a script to remove product titles from automatic translation. That would require custom programming.

January 24, 2023 at 4:13 pm #12883769

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

This has been escalated to a feature request and ultimately will be up to our developers to decide if or when to implement this request. We include all updates in our changelog when new versions are released.

February 16, 2023 at 6:37 pm #13051837

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Our developers are not planning to implement this as a feature, but they did come up with a workaround that you can use. Please see the following code that you can add to your site to exlcude the title:

add_filter('wpml_tm_job_field_is_translatable', 'testfield', 10, 2);
function testfield($is_translatable, $job_translate){
    global $wpdb;
    $postid = $wpdb->get_var( $wpdb->prepare("SELECT `field_data` FROM `wp_icl_translate` WHERE `field_type` = 'original_id' AND `job_id` = %d", $job_translate["job_id"] ));
    $posttype = get_post_type($postid);
    if ($job_translate["field_type"] == "title" && $posttype == "product") {
      return false;
    } else {
      return true;
    }
}