Sometimes we get requests from clients to show post comments from all languages/translations on each post. For example, a client has a site where English is the default language, and French is the second language. By default, comments added to a post in English will not show on the translation into French and vice versa. Nevertheless, adding the following function in the functions.php file of the theme will make all comments show. On the post in English, comments in English and French will show, and vice versa.
/** * ALSO SHOW COMMENTS FROM OTHER LANGUAGES */ global $sitepress; remove_filter( 'comments_clauses', array( $sitepress, 'comments_clauses' ), 10, 2 ); add_action('pre_get_comments', function($c){ $id = []; $languages = apply_filters('wpml_active_languages', ''); if( 1 query_vars['post_id'], 'page', FALSE, $l['code']); } } $c->query_vars['post_id'] = ''; $c->query_vars['post__in'] = $id; return $c; });