• Skip to primary navigation
  • Skip to main content

[m]utuality

WordPress Development, Support & Site Care

  • How Does It Work?
  • Services
  • About Us
    • Ethics
  • Show Search
Hide Search

Remove sticky posts from the main loop


function mtly_remove_sticky_posts_from_main_loop( $query ) {
	if( $query->is_main_query() && ! is_admin() ) {
		$query->set( 'ignore_sticky_posts', true );
	}
}

add_action( 'pre_get_posts', 'mtly_remove_sticky_posts_from_main_loop' );

Written by:
admin
Published on:
March 31, 2018

Explore more

We're here to listen and help.

Share your aspirations and challenges with us,
and let's work together to create the perfect solution.