Skip to content

Commit

Permalink
Merge branch 'fix/pre-get-posts'
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender committed Jun 12, 2018
2 parents c89c405 + 8105b71 commit 136072e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions includes/QueryIntegration/WPQueryIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public function setup() {
}

public function posts_where( $where, $query ) {
if ( isset( $query->query['relationship_query'] ) ) {
$post_type = isset( $query->query['post_type'] ) ? $query->query['post_type'] : '';
if ( isset( $query->query_vars['relationship_query'] ) ) {
$post_type = isset( $query->query_vars['post_type'] ) ? $query->query_vars['post_type'] : '';

// Adding to the query, so that we can fetch it from the other filter methods below and be dealing with the same data
$query->relationship_query = new RelationshipQuery( $query->query['relationship_query'], $post_type );
$query->relationship_query = new RelationshipQuery( $query->query_vars['relationship_query'], $post_type );

$where .= $query->relationship_query->where;
}
Expand Down Expand Up @@ -55,7 +55,7 @@ public function posts_orderby( $orderby, $query ) {
* If orderby is anything other than relationship (array, etc) we don't allow it.
* Trying to allow multiple order by statements would likely end in confusing results
*/
if ( ! isset( $query->query['orderby'] ) || $query->query['orderby'] !== 'relationship' ) {
if ( ! isset( $query->query_vars['orderby'] ) || $query->query_vars['orderby'] !== 'relationship' ) {
return $orderby;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public function test_orderby_only_works_with_one_segment() {

$query = new \stdClass();

$query->query = array(
$query->query_vars = array(
'orderby' => 'relationship',
);

Expand Down

0 comments on commit 136072e

Please sign in to comment.