Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #59 from cmmarslender/master

Check if the global $wp_query is null before using get_query_var....
  • Loading branch information...
commit 174c5cb2568bd08cc245cdb5bd192bc28c4c10ca 2 parents f3f76e1 + 66f4bae
@tlovett1 authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 safe-redirect-manager.php
View
12 safe-redirect-manager.php
@@ -107,7 +107,9 @@ public function action_init_load_textdomain() {
* @return string
*/
public function filter_search_join( $join ) {
- if ( $this->redirect_post_type != get_query_var( 'post_type' ) )
+ global $wp_query;
+
+ if ( empty( $wp_query ) || $this->redirect_post_type != get_query_var( 'post_type' ) )
return $join;
global $wpdb;
@@ -128,7 +130,9 @@ public function filter_search_join( $join ) {
* @return string
*/
public function filter_search_distinct( $distinct ) {
- if ( $this->redirect_post_type != get_query_var( 'post_type' ) )
+ global $wp_query;
+
+ if ( empty( $wp_query ) || $this->redirect_post_type != get_query_var( 'post_type' ) )
return $distinct;
return 'DISTINCT';
@@ -143,7 +147,9 @@ public function filter_search_distinct( $distinct ) {
* @return string
*/
public function filter_search_where( $where ) {
- if ( $this->redirect_post_type != get_query_var( 'post_type' ) || ! is_search() || empty( $where ) )
+ global $wp_query;
+
+ if ( empty( $wp_query ) || $this->redirect_post_type != get_query_var( 'post_type' ) || ! is_search() || empty( $where ) )
return $where;
$exact = get_query_var( 'exact' );
Please sign in to comment.
Something went wrong with that request. Please try again.