Sticky Post showing on all paged pages
-
My front page displays posts, limited to 5 per page, with a sticky post at the top. When I go to the 2nd page, the sticky post is also at the top of the 2nd page, but I don’t want it to repeat like that. I’ve tried adding the following to functions.php, but it’s hiding the sticky post everywhere now.
add_action( 'pre_get_posts', function ( WP_Query $query ) { if ( ! $query->is_main_query() ) { return; } if ( ! $query->is_home() ) { return; } if ( $query->get( 'paged', 1 ) == 1 ) { return; } $query->set ( 'post__not_in', array( 658 ) ); });
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Sticky Post showing on all paged pages’ is closed to new replies.