Skip to content

Commit

Permalink
Removed duplicate left join for optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Hum committed May 30, 2017
1 parent 525f211 commit 6e7da2b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,9 @@ function posts_join_filter( $join, $query ) {

// Check to see that JOIN hasn't already been added. Props michaelingp and nbaxley
$term_relationship_inner_join = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$term_relationship_left_join = " LEFT JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$term_relationship_left_join = " LEFT JOIN {$wpdb->term_relationships} AS tr1 ON ({$wpdb->posts}.ID = tr1.object_id)";

$term_taxonomy_join = " INNER JOIN {$wpdb->term_relationships} AS tr1 ON ({$wpdb->posts}.ID = tr1.object_id)";
$term_taxonomy_join .= " INNER JOIN {$wpdb->term_taxonomy} ON ( tr1.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";
$term_taxonomy_join = " INNER JOIN {$wpdb->term_taxonomy} ON ( tr1.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";

// 4.6+ uses a LEFT JOIN for tax queries so we need to check for both
if ( false === strpos( $join, trim( $term_relationship_inner_join ) )
Expand Down

0 comments on commit 6e7da2b

Please sign in to comment.