Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeherve/9739690 to your computer and use it in GitHub Desktop.
Save jeherve/9739690 to your computer and use it in GitHub Desktop.
Custom home query - remove sticky posts
<?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