Conversation
supportHi somebody found a solution for this issue? Zanto uses the url with post id ( http://mysite.org/ensite?p=12 ) instead of the url with the slug ( http://mysite.org/ensite/post-slug ). This happens in language switcher tags <a href="http://mysite.org/ensite?p=12" hreflang="en-US" rel="alternate">English</a> and in header tags: <link href="http://mysite.org/ensite?p=12" hreflang="en-US" rel="alternate"> . I think that due to this issue Google Search Console throw the error “No return tags”… kappa had this problem and explains it in this post https://wordpress.org/support/topic/language-switcher-dep?replies=2 https://wordpress.org/plugins/zanto/
Hi there! I have the same problem. This plugins seems to be deprecated… it’s so sad. I’m trying to fix the issue.
Try something like this: function get_tranlated_url($url){ $current_sites = wp_get_sites(); $original_blog_id = get_current_blog_id(); $translated_url = ""; foreach($current_sites as $site): if($site['blog_id'] != $original_blog_id){ switch_to_blog( $site['blog_id'] ); $translated_url = get_permalink(url_to_postid($url)); } endforeach; // Switch back to the current blog switch_to_blog( $original_blog_id ); return $translated_url; }
Hi there! I have the same problem. This plugins seems to be deprecated… it’s so sad. I’m trying to fix the issue.
Try something like this: function get_tranlated_url($url){ $current_sites = wp_get_sites(); $original_blog_id = get_current_blog_id(); $translated_url = ""; foreach($current_sites as $site): if($site['blog_id'] != $original_blog_id){ switch_to_blog( $site['blog_id'] ); $translated_url = get_permalink(url_to_postid($url)); } endforeach; // Switch back to the current blog switch_to_blog( $original_blog_id ); return $translated_url; }