{"id":1262,"date":"2022-08-30T15:15:04","date_gmt":"2022-08-30T15:15:04","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/wordpress-error-since-update-3-2-1-to-3-5-1-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:04","modified_gmt":"2022-08-30T15:15:04","slug":"wordpress-error-since-update-3-2-1-to-3-5-1-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/wordpress-error-since-update-3-2-1-to-3-5-1-collection-of-common-programming-errors\/","title":{"rendered":"WordPress error since update 3.2.1 to 3.5.1-Collection of common programming errors"},"content":{"rendered":"<p>Since I have updated wordpress 3.2.1 to 3.5.1 I have this error. One month looking for this error and so far, I can not find a solution even know what file causing this error.<\/p>\n<pre><code>[16-Mar-2013 11:36:35 UTC] Erro na base de dados do WordPress Unknown column `'wp_term_relationships.term_taxonomy_id'` in `'where clause'` na query \n\nSELECT SQL_CALC_FOUND_ROWS  wp_posts.*, \nIF( wp_posts.ID IN (\n337,225,673,12,6719,7880,11242,27505,34630,10551,38533,38531), 1, 0) AS featured \nFROM wp_posts  \nINNER JOIN wp_term_relationships AS r ON (wp_posts.ID = r.object_id)  \nINNER JOIN wp_term_taxonomy AS x ON (r.term_taxonomy_id = x.term_taxonomy_id)  \nAND (x.taxonomy = 'ad_tag' OR x.taxonomy = 'ad_cat' OR 1=1)  \nINNER JOIN wp_postmeta AS m ON (wp_posts.ID = m.post_id)  \nINNER JOIN wp_terms AS t ON x.term_id = t.term_id  \nWHERE 1=1  AND ( wp_term_relationships.term_taxonomy_id IN (726) ) \nAND wp_posts.post_type IN ('post', 'page', 'attachment', 'ad_listing') \nAND (wp_posts.post_status = 'publish') \nGROUP BY wp_posts.ID \nORDER BY featured DESC, wp_posts.post_date DESC LIMIT 0, 10 \n<\/code><\/pre>\n<p>feita por <code>require('wp-blog-header.php')<\/code>, <code>wp<\/code>, <code>WP-&gt;main<\/code>, <code>WP-&gt;query_posts<\/code>, <code>WP_Query-&gt;query<\/code>, <code>WP_Query-&gt;get_posts<\/code><\/p>\n<ol>\n<li>\n<p>This is really a pure MySQL questions but what you&#8217;ve done is <code>JOIN<\/code> <code>wp_term_relationships<\/code> as <code>r<\/code>&#8212;<\/p>\n<p><code>INNER JOIN wp_term_relationships AS r ON (wp_posts.ID = r.object_id)<\/code><\/p>\n<p>, which means that there is no table in the query scope named <code>wp_terms_relationships<\/code>. That table is aliased as <code>r<\/code>. Yet your code tries to access <code>wp_term_relationships<\/code>&#8212;<\/p>\n<p><code>AND ( wp_term_relationships.term_taxonomy_id IN (726) )<\/code>.<\/p>\n<p>That should be <code>AND ( r.term_taxonomy_id IN (726) )<\/code> as in a couple of other places in the query. For example, <code>INNER JOIN wp_term_taxonomy AS x ON (r.term_taxonomy_id = x.term_taxonomy_id)<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:12:41. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Since I have updated wordpress 3.2.1 to 3.5.1 I have this error. One month looking for this error and so far, I can not find a solution even know what file causing this error. [16-Mar-2013 11:36:35 UTC] Erro na base de dados do WordPress Unknown column `&#8217;wp_term_relationships.term_taxonomy_id&#8217;` in `&#8217;where clause&#8217;` na query SELECT SQL_CALC_FOUND_ROWS wp_posts.*, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1262","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1262"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1262\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}