Last active
August 29, 2015 14:00
-
-
Save yllus/2f18709aa9371f17e9f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Disable WordPress's home page query (as much as we can). | |
| function home_page_query_disable( $query ) { | |
| if ( !is_admin() && $query->is_main_query() ) { | |
| if ( $query->is_home ) { | |
| // Add a filter that effectively returns no results ever. | |
| add_filter('posts_where', 'disable_query_filter'); | |
| } | |
| } | |
| return $query; | |
| } | |
| add_action('pre_get_posts', 'disable_query_filter'); | |
| // The WHERE search filter for disabling the default home page query. | |
| function disable_query_filter( $where = '' ) { | |
| $where = " AND 0 = 1"; | |
| return $where; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment