Skip to main content

URL sync and shareable filters

Divi 4 and Divi 5

URL sync uses the same front-end helpers for Archive Loop workflows and Divi 5 Loop Builder targets. Behavior below applies whenever Divi Ajax Filter updates results via AJAX.

Purpose

When visitors change filters, Divi Ajax Filter updates the browser URL with history.replaceState so the address bar reflects the active filter state. Visitors can:

  • Copy the URL and share a filtered view
  • Bookmark a filtered catalog or archive
  • Use the browser back/forward history without losing filter context on reload of that URL

How URL sync works

Filter session flag

The first active filter adds a filter=true query flag (also accepted as 1, yes, or on). That flag tells the script the page is in a filtered session.

Example shape:

https://example.com/shop/?filter=true&product_cat=shoes&min_price=20&max_price=80

Exact parameter names come from each Filter Posts Item (taxonomy slugs, meta keys, price fields, and so on).

Writing parameters

As visitors change filters, the script:

  1. Collects values from each .search_filter_cont filter control
  2. Writes or updates matching query parameters
  3. Removes a parameter when that filter is cleared
  4. Runs the AJAX filter request so results match the URL

Restoring from a URL

On page load, if the URL includes the filter flag, the script reads query parameters, applies them to matching filter controls (data-name keys), and refreshes the target loop so the UI matches the shared link.

Reset

Clicking Reset clears filter controls and strips the query string back to the page path (no filter parameters), then reloads the unfiltered loop state.

Pagination and sorting in the URL

  • Pagination — Page numbers sync into the URL (for example page, paged, or a custom loop page key). Changing filters resets pagination to page 1.
  • Sorting — Catalog or loop orderby values can sync into the URL when visitors change sort controls.
  • AJAX pagination — When AJAX pagination is enabled, page clicks update the URL and refresh results without a full reload.

See also Pagination preserves filters.

Archive Loop vs Loop Builder

Results targetURL sync
Archive LoopFilter params and pagination sync through the main Ajax Filter front-end script.
Loop BuilderDivi 5 Loop Builder targets use the same URL helper pattern so shared links restore filters and page state.

Set Target loop (or the Loop Builder equivalent) correctly so the loop that updates is the one visitors see when they open the shared URL.

Practical tips

  1. Test a shared link in a private window — Confirm filters and results restore without being logged in as an editor.
  2. Keep post types aligned — Filter Posts and the results loop must query the same post type.
  3. Avoid conflicting query params — Custom theme or plugin query vars can collide with filter parameter names; rename filter item keys if needed.
  4. Caching — Aggressive page cache that ignores query strings can serve an unfiltered HTML shell. Exclude filtered URLs or cache AJAX responses carefully. See Caching and performance.
  5. Select2 / chips — Active selections still sync to the URL; Select2 and filter parameter chips update the UI after restore.

What's Next