/**
  * @param string            $link
  * @param int               $post
  * @param WPML_Post_Element $post_element
  *
  * @return bool|false|mixed|string
  */
 public function get_translated_permalink($link, $post, $post_element)
 {
     $code = $this->get_permalink_filter_lang($post);
     $post_id = $post_element->get_element_id();
     $current_language = $this->sitepress->get_current_language();
     if (!is_admin() && $this->sitepress->get_setting('auto_adjust_ids') && $post_element->get_language_code() !== $this->sitepress->get_current_language() && ($post_id = $this->post_translation->element_id_in($post_id, $current_language))) {
         $link = get_permalink($post_id);
     } else {
         $link = $this->url_converter->convert_url($link, $code);
     }
     if ($this->sitepress->get_wp_api()->is_feed()) {
         $link = str_replace('&lang=', '&lang=', $link);
     }
     return $link;
 }