{"id":6807262,"date":"2015-12-02T18:13:39","date_gmt":"2015-12-02T18:13:39","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/bug-found-in-includesitephp\/"},"modified":"2016-08-30T20:53:54","modified_gmt":"2016-08-30T20:53:54","slug":"bug-found-in-includesitephp","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/bug-found-in-includesitephp\/","title":{"rendered":"Bug found in include\/site.php"},"content":{"rendered":"<p>Hi,<\/p>\n<p>after some digging I found why some of my categories do not display in the translated version. The reason is that term_taxonomy.parent refers to term_taxonomy.term_id, NOT to term_taxonomy.taxonomy_id.<br \/>\nIn most cases both are the same, hence the bug may not show on many sites. On mine it does.<\/p>\n<p>It is easily fixed by changing lines 949 to 955 of site.php (Version 1.47) to:<\/p>\n<pre><code>\/\/ need find parent:\n$term = $wpdb-&gt;get_row($wpdb-&gt;prepare(\n    &quot;SELECT t.term_id, t.slug, tt.taxonomy, tt.parent FROM $wpdb-&gt;terms AS t\n    INNER JOIN $wpdb-&gt;term_taxonomy AS tt ON t.term_id = tt.term_id\n    WHERE tt.taxonomy = %s AND tt.term_id &quot;.(count($translation_parents) === 1 ? &#039;= &#039;.$translation_parents[0] : &#039;IN (&#039;.implode(&#039;,&#039;,$translation_parents).&#039;)&#039;),\n    $taxonomy\n));<\/code><\/pre>\n<p>As you see, I swapped tt.term_id for tt.taxonomy_id in the WHERE clause.<\/p>\n<p>Else, as much as I have seen so far: great tool, great help. Exactly what I was looking for.<\/p>\n<p>Cheers<br \/>\nHenrik<\/p>\n<p>https:\/\/wordpress.org\/plugins\/sublanguage\/<\/p>\n","protected":false},"template":"","class_list":["post-6807262","topic","type-topic","status-publish","hentry","topic-tag-category","topic-tag-term_id","topic-tag-translated"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6807262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6807262\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6807262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}