Created
December 22, 2011 06:43
-
-
Save trepmal/1509277 to your computer and use it in GitHub Desktop.
WordPress: No Front-Page Sticky Posts
This file contains 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 | |
//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