Use LEFT JOIN when building WP_Tax_Query SQL.
`LEFT JOIN` ensures that `NOT EXISTS` queries will not miss posts that have no taxonomy data whatsoever. Props swissspidy, crstauf. Fixes #36343. Built from https://develop.svn.wordpress.org/trunk@37184 git-svn-id: http://core.svn.wordpress.org/trunk@37151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -440,7 +440,7 @@ class WP_Tax_Query {
|
||||
// Store the alias with this clause, so later siblings can use it.
|
||||
$clause['alias'] = $alias;
|
||||
|
||||
$join .= " INNER JOIN $wpdb->term_relationships";
|
||||
$join .= " LEFT JOIN $wpdb->term_relationships";
|
||||
$join .= $i ? " AS $alias" : '';
|
||||
$join .= " ON ($this->primary_table.$this->primary_id_column = $alias.object_id)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user