: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
class WPML_Translation_Selector extends WPML_SP_User {
private $default_language_code;
private $source_language_code;
public function __construct( &$sitepress, $default_language, $source_language, $element_id ) {
$this->default_language_code = $default_language;
$this->source_language_code = $source_language;
$this->element_id = $element_id;
parent::__construct( $sitepress );
function add_translation_of_selector_to_page( $trid, $current_language, $selected_language, $untranslated_ids ) {
$default_language = $this->default_language_code;
$source_language = $this->source_language_code;
<input type="hidden" name="icl_trid" value="<?php echo $trid ?>"/>
if ( $selected_language !== $default_language && 'all' !== $current_language ) {
<?php echo __ ( 'This is a translation of', 'sitepress' ); ?><br/>
<select name="icl_translation_of"
id="icl_translation_of"<?php if ( ! $this->sitepress->get_wp_api()->is_term_edit_page() && $trid ) {
<option value="none"><?php echo __ ( '--None--', 'sitepress' ) ?></option>
$src_term = $this->get_original_name_by_trid($trid);
if ( $src_term !== null ) {
<option value="<?php echo $src_term->ttid; ?>"
selected="selected"><?php echo $src_term->name; ?></option>
<option value="none" selected="selected"><?php echo __ ( '--None--', 'sitepress' ); ?></option>
if ( !$source_language || $source_language === $default_language ) {
foreach ( $untranslated_ids as $translation_of_id ) {
$title = $this->get_name_by_ttid ( $translation_of_id );
<option value="<?php echo $translation_of_id; ?>"><?php echo $title; ?></option>
private function get_name_by_ttid( $ttid ) {
JOIN {$wpdb->term_taxonomy} tt
ON t.term_id = tt.term_id
WHERE tt.term_taxonomy_id = %d
private function get_original_name_by_trid( $trid ) {
$src_snippet = $this->source_language_code ? $wpdb->prepare (
" AND language_code = %s LIMIT 1",
$this->source_language_code
$all_translations = $wpdb->get_results (
" SELECT t.name, i.element_id as ttid, i.language_code
JOIN {$wpdb->term_taxonomy} tt
ON t.term_id = tt.term_id
JOIN {$wpdb->prefix}icl_translations i
ON i.element_type = CONCAT('tax_', tt.taxonomy)
AND i.element_id = tt.term_taxonomy_id
foreach ( $all_translations as $translation ) {
$res = $res === null ? $translation : $res;
if ( $translation->language_code === $this->default_language_code ) {