Skip to content

Commit

Permalink
Suppress main query
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed May 27, 2017
1 parent 079d9e5 commit a235448
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,22 @@ function dones_register_custom_types() {
}
add_action( 'init', 'dones_register_custom_types' );

/**
* Suppresses main query, since we don't use it.
*
* @param string $request The complete SQL query
* @param WP_Query &$this The WP_Query instance (passed by reference)
* @return string|bool $request The complete SQL query, or false if main query
*/
function dones_disable_main_query( $request, $query ) {
if ( $query->is_main_query() ) {
return false;
}

return $request;
}
add_action( 'posts_request', 'dones_disable_main_query', 10, 2 );

/**
* Removes the Done Tags column from the manage (admin) list view
*/
Expand Down

0 comments on commit a235448

Please sign in to comment.