CS Forms & Filter Archiv on paginated page

I’ve tried out the new filtering option in my portfolio archive using CS Form and Ajax. It works fine so far, as long as you’re not on a paginated page with “page” parameters in the url. So, if I’m on page 2 or higher in the archive, the Ajax filter no longer works.

That seems only to work if you set up the pagination navigation inside the target Ajax container. Otherwise, the pagination will still be displayed with the original query amount of pages and breaks the ajax filter.

Maybe you can add a warning in the documentation to mention this.

Hey @Regnalf,

Thanks for writing in! Do you have a Looper Provider in your layout? We would be happy to double check your site if we can log in. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

I can’t grant access to the live site. But I can give you the exact steps to follow for testing.

  1. This is an archive page; no Looper provider is involved, just the one that comes natively with WordPress for the archive.

  2. A filter, for example for a category or tag, using CS Forms.

  3. The pagination navigation must be outside the Ajax target element; this is important so that the ‘page’ parameter appears in the URL.

  4. Then go to page 2 or higher so that the URL pagination appears, and apply the CS Forms Ajax filter there. It won’t work then.

Hello @Regnalf,

You are absolutely right to point this out. Here’s the technical reason: when you’re on page/2/ , the native paged variable is passed to the AJAX filter. Since filtered results usually have fewer total posts, the query asks for ‘Page 2’ of a result set that may only have 1 page—returning zero posts, which makes it look broken.

Regarding the pagination outside the container: you are spot on. If the AJAX callback only replaces the inner posts and ignores the outer pagination wrapper, the page numbers stay stuck on the original total. The proper fix is to have the AJAX response return both the updated posts and the updated pagination HTML, then replace both elements via JavaScript.

Also, to ensure filters work on paginated URLs, the AJAX request must explicitly set paged=1 whenever a new filter is applied. This forces the query to start fresh from Page 1.

We fully agree with your documentation suggestion. We’ll add a warning clearly stating that if pagination is placed outside the AJAX target, developers must manually handle updating it via the callback. Thanks for the detailed testing steps—this is very helpful!"

Hope this helps.