We're merging with GenerateBlocks! Learn more here.

[Support request] Offset breaks pagination

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Offset breaks pagination

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #4621

    There is a bug that breaks pagination if any value is filled into the offset field.

    This screencast will demonstrate how to reproduce the bug.


    The bug is present in both Pro and regular WP Show Posts. I’m running the latest version of each.


    Thanks for the video, appreciate it!

    Seems like a known issue in WP: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination

    I’m play around with the solutions they mentioned.

    Thanks again!


    Has there been any progress on this?

    I am having this same issue on http://www.rookiecollector.com homepage.

    I want to have basically 2 featured posts at the top, and then below it paginated latest posts.

    Right now, since my “featured” posts are my 2 most recent, I want to offset the 2nd listing of posts by 2. However, when I do the offset pagination breaks and all of the pages are identical.’

    EDIT: Also, the website that I got the idea for this layout from seems to be having no issue achieving what I want. Not sure if they’ve done some self modification of the WPShowPosts code or not: https://nogluten.com/

    EDIT again: My temporary fix is to update the 2nd list to manually exclude the 2 post IDs from the top list for the time being. Annoying fix but it works.


    That fix might be the best method.

    An alternative is this function, but I’m not 100% confident it will work:

    add_filter( 'pre_get_posts', function( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $offset = 2;
            $ppp = get_option('posts_per_page');
            if ( $query->is_paged ) {
                $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );
                $query->set('offset', $page_offset );
            } else {
        } else {
            return $query;
    } );
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.