Last active
August 29, 2015 13:57
-
-
Save jeherve/9739690 to your computer and use it in GitHub Desktop.
Custom home query - remove sticky posts
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
<?php | |
// Customize the loop on your home page only | |
function jeherve_custom_home_query( $query ) { | |
if ( ! $query->is_main_query() ) | |
return; | |
if ( ! $query->is_home() || ! $query->is_front_page() || is_admin() ) | |
return; | |
$query->set( 'ignore_sticky_posts', true ); | |
} | |
add_filter( 'pre_get_posts', 'jeherve_custom_home_query' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment