Originally posted on https://onthegosystems.myjetbrains.com/youtrack/issue/wpmlsupp-7499#focus=Comments-102-398599.0-0
Sometimes we have customers who want to translate numeric values using the translation editor (e.g. translating a numeric attribute from a shortcode). However, only numeric values are automatically removed by the Translation Editor.
As a workaround, it’s possible to enable numbers by adding the following code to the functions.php file:
/**
* Allow translating numbers
*
* @see https://wpml.org/forums/topic/wpbakery-post-grid-element-exclude-from-filter-list-category-reappears
*/
function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
$data = $job_translate['field_data'];
if ( 'base64' === $job_translate['field_format'] ) {
$data = base64_decode( $data );
}
if ( is_numeric( $data ) ) {
return true;
}
return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );
Support Thread Example
Let us know if this snippet is not working for you:
This snippet doesn’t work