Pagination on query leads to 404 when loading next page

Hi there,

i just ran into this and i’m wondering what’s the mistake behind that.

Setup: WP 7.0.2 with Bricks 2.3.9

Structure:

News Teaser Items has a query inside that loops over an ACF custom post type (“news”):

Pagination element settings:

Basically, the pagination is displayed and shows the paginated page links.

  1. with default setting (reload page on click) in preview mode:
    link to page 2 /aktuelles-und-mehr/page/2/ leads to 404.

  2. with setting for ajax load, in preview mode:
    link to page 2 /aktuelles-und-mehr/page/2/?bricks_preview=1784558044&lang=de works fine, as well as navigating back to page 1.
    But when that same url is reloaded, page returns a 404. :thinking:

  3. without preview mode, none of them do work, regardless if ajax load or default setting is used (always leads to 404).

Re-saving permalinks didn’t have any effect.

Any ideas?
Thanks for any help.

Hi Lars,
This usually comes from the query/pagination setup rather than permalinks.

Unfortunately, you posted the query screenshot twice, so it’s hard to tell what the settings for the pagination element look like.

Please check these:

  • In the Pagination element, set Query to the actual News query loop, not Main (if available), unless this is the archive/search main query.
  • Try to enable Is main query on the query loop only – that usually solves pagination problems (try hovering over the “i” icon ;-))
  • Additionaly, try to enable “Disable Query Merge” on the loop

If it still returns 404 after those checks, please send login credentials, information on where we can see the issue and a link to this thread to help@bricksbuilder.io

Hi Timmse,

thanks for the reply.

My bad, i’ve uploaded the correct screenshot.
I gave your suggestions a try but unfortunately without any result.

One guess that may be worth a look is the ACF rewrite setup (ACF post type slug: “/news” becomes “/aktuelles-und-mehr”).

Since this is a client/agency project, I will have to check if i am allowed to share credentials and will get back on you.

Hi @larsactionhero

Please tick “Is main query” if this is meant for your archive page/template.

Regards,
Jenn

Hi @itchycode ,

as @timmse wrote:

Please check these:
In the Pagination element, set Query to the actual News query loop, not Main (if available), unless this is the archive/search main query.
Try to enable Is main query on the query loop only – that usually solves pagination problems (try hovering over the “i” icon ;-))
Additionaly, try to enable “Disable Query Merge” on the loop

I’ve tried all these ways but without any result.
Additionally, this is no archive query.

Hi @larsactionhero ,

Did you try switching to a default theme and check if the URL also leads you to a 404?

Found the issue. :smiley:

Issue was a conflict of 2 rewrite rules between page slug aktuelles-und-mehr and the CPT custom slug that accidentially was also named aktuelles-und-mehr (which lead to an collision and technically unresolvable url → 404🤷‍♂️).

So thanks for the help!