Skip to content

Instantly share code, notes, and snippets.

@trepmal
Created December 22, 2011 06:43
Show Gist options
  • Save trepmal/1509277 to your computer and use it in GitHub Desktop.
Save trepmal/1509277 to your computer and use it in GitHub Desktop.
WordPress: No Front-Page Sticky Posts
<?php
//Plugin Name: No Front-Page Sticky Posts
//Description: Disables sticky posts on the front page (main blog page)
/*
upload this file to wp-content/mu-plugins
it'll automatically run, no need for activation
if multisite, it will run for *all* sites
-OR-
upload to wp-content/plugins
and activate through the plugins page in the admin
*/
function no_stickies_on_home( $query ) {
if ( $query->is_home ) {
$query->set( 'ignore_sticky_posts', true );
}
}
add_action( 'pre_get_posts', 'no_stickies_on_home' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment