How to Exclude Sticky Posts from Adjacent Post Links

add_filter('get_previous_post_where', 'remove_stickies_adjacent');
add_filter('get_next_post_where', 'remove_stickies_adjacent');
function remove_stickies_adjacent($where) {
	return $where . ' AND p.ID NOT IN (' . implode(',', get_option('sticky_posts')) . ')';
}

Leave a Reply