PluginProbe
AI Builder – Generate pages, blocks, images & translate with AI / 2.7.2
AI Builder – Generate pages, blocks, images & translate with AI v2.7.2
2.8.0 2.7.10 2.7.9 2.7.8 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 All 123 releases
← All changes | includes/class-translation-manager.php +13 -0 2.2.42.7.2 View file →
@@ -98,8 +98,21 @@
98 98 if (!$post) {
99 99 return $permalink;
100 100 }
101 101
102 + // Only append ai_lang if this post actually belongs to a translation group
103 + // and has at least one other translation. Otherwise, keep the URL clean.
104 + $group = get_post_meta($post->ID, '_ai_translation_group', true);
105 + if (!$group) {
106 + return $permalink;
107 + }
108 +
109 + $translations = $this->get_group_posts($group, get_post_type($post));
110 + if (empty($translations) || count($translations) <= 1) {
111 + // No real translations available for this post
112 + return $permalink;
113 + }
114 +
102 115 $default_lang = $this->settings['default_lang'];
103 116 $lang = get_post_meta($post->ID, '_ai_lang', true) ?: $default_lang;
104 117
105 118 // Avoid duplicating the parameter if it's already there.