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:
Boone Gorges 2016-04-12 20:37:26 +00:00
parent 15889b6397
commit 20b1b2098a
2 changed files with 2 additions and 2 deletions

View File

@ -440,7 +440,7 @@ class WP_Tax_Query {
// Store the alias with this clause, so later siblings can use it. // Store the alias with this clause, so later siblings can use it.
$clause['alias'] = $alias; $clause['alias'] = $alias;
$join .= " INNER JOIN $wpdb->term_relationships"; $join .= " LEFT JOIN $wpdb->term_relationships";
$join .= $i ? " AS $alias" : ''; $join .= $i ? " AS $alias" : '';
$join .= " ON ($this->primary_table.$this->primary_id_column = $alias.object_id)"; $join .= " ON ($this->primary_table.$this->primary_id_column = $alias.object_id)";
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-alpha-37183'; $wp_version = '4.6-alpha-37184';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.