Load More Button showing duplicate content
If you're loading new posts using the Load More Button option in the Posts element it will load duplicate content if you have also set an Offset. To fix this add the following to your child theme's functions.php file:
function ghostpool_adjust_load_more_offset_pagination( $found_posts, $query ) { if ( ! is_admin() && ! $query->is_main_query() && isset( $query->query_vars['offset'] ) ) { $offset = $query->query_vars['offset']; return $found_posts - $query->offset; } else { return $found_posts; } } add_filter( 'found_posts', 'ghostpool_adjust_load_more_offset_pagination', 1, 2 ); function ghostpool_load_more_current_queries( $query ) { if ( is_admin() OR $query->is_main_query() ) { return; } if ( isset( $query->query_vars['offset'] ) ) { $offset = $query->query_vars['offset']; } else { return; } $posts_per_page = $query->query_vars['posts_per_page']; if ( $query->is_paged() ) { $page_offset = $offset + ( ( $query->query_vars['paged'] - 1 ) * $posts_per_page ); $query->set( 'offset', $page_offset ); } else { $query->set( 'offset', $offset ); } } add_action( 'pre_get_posts', 'ghostpool_load_more_current_queries' );
Make sure to change the $offset and $posts_per_page values to what you have set in your Posts element.