WordPress + Algolia query parameters conflict

On my WordPress site I use Algolia to search Woocommerce products.

Everything works as expected on category pages e.g. www.example.com/products

Read More

The problem occurs on the domain root. When I do the search, query parameters are being added: www.example.com/?q=myquery&hPP=12&idx=all&p=0&is_v=1, and now if I reload the page, I’ll be taken to the page of blog posts, most probably WordPress native search results…

Desired action would be the same as it is on the category pages, or anywhere other than root, so that after page reload it should show the exact same page with exact same search query.

Possible solutions I can think of:

  1. Disable query parameters for WordPress, so that it would not take any action if the URL contains one
  2. Change Algolia’s query parameters into something that WordPress would not take as a search query, the problem seems to be the &p=0, removing this, and reloading the page works as desired.

PS! In the WordPress permalinks settings I have chosen http://www.domain.com/%postname%/

Related posts

1 comment

  1. It seems like you’re aware of this, but since others could stumble upon your question, I’ll just state here that the Algolia for WordPress integration is, at the time of the writing, currently in beta and not supported (see the warning in the repo’s README).

    Also, based on the parameters you’re talking about, it seems like you’re using the latest version in the develop branch of the repository.

    In this version, the query parameters are added in the URL by a library used internally called instantsearch.js.


    This library, on initialization, exposes the urlSync.useHash parameter which will make the library store these parameters in the hash instead of the query parameters. Just set it to true.

    If set to true, the url will be hash based. Otherwise, it’ll use the query parameters using the modern history API.


    Since here there seems to be only one parameter which causes trouble, the urlSync.mapping parameter might be a better solution. However, I’m not sure this option is available in the instantsearch.js version the integration is using.

    Object used to define replacement query parameter to use in place of another. Keys are current query parameters and value the new value, e.g. { q: 'query' }.

    In your case, this would be { p: 'new_parameter_name_that_wont_conflict' }.

Comments are closed.