How to prevent the page contextual filter to be appended to the page url when using contextual filters in drupal?


I don't think so. Because the page results is being filtered by the contextual filter before the exposed filters.

Why do you use "myview/12"?! Why don't only use "myview" without anything passed as contextual filter ?

UPDATE: To exclude the contextual filter from the URL, you need to change the the form's redirect attribute by applying hook_form_alter(). To do so you need to follow the following steps:

  1. find the form id.
  2. Change your module weight in "system" table. (Because views' weight defaults to 10, your module needs to have a heavier weight to make sure it affects the form generated by views)
  3. change the the form redirect attribute. $form['#redirect'] = 'myview';

Tell me if it worked.


You can give a try to the Views Filter Harmonizer module. This module solves the problem when having views with contextual filter and exposed filters at the same tima and you can configure it to make them work independantly.

Provide a validation criteria, that fails if there is some exposed filter in the url, and select to display all values if the validation criteria fails.

Similar questions

Digit 2 Appended to Field Name on Column in Entity Field Query
I have an Entity Field Query that has fieldCondition for field_email I have verified that this is the name of the field and I have other entity queries that use this field correctly. However, in this example, Drupal is adding the digit 2 on to the field name as I understand the error returned. SQLSTATE[42S22]: Column not found: 1054 Unknown column ...
How do I remove the appended string from image and Javascript URLs?
I have a Drupal 8 website. I have installed the Advagg module. The URL for the JavaScript file has a string appended. The same happens for the URLs of the uploaded images. Sometimes, the browser doesn't display the image, when its URL has that string. If I remove the string, the image is displayed. Google search console reports such files as malwar...
Cannot get click event on appended anchors
I am sure this has something to do with clone() but I could not find anything on it. My problem is that I am adding in some HTML with anchors. Those anchors should respond to click() and then start an ajax call. I can't seem to stop the anchors default event from working on the $('.term a').
How to show nodes of a content type using contextual filters as filters?
I have a profile page for each user where it will show all nodes he has created for each content type. For instance, Autos content type will only list all autos he has authored. I'd like to be able for the user to access it using this path : http://localhost/mysite/myreports/autos and will show his autos, .../myreports/jobs will show his job postin...
Exposed form for contextual filters when using non-taxonomy filters?
I have a View with some contextual filters which works great. I also need to provide my users with some way to change the filters once they're on the page. I've tried using exposed filters but I'd rather use path arguments over query string parameters and there is the conflicting issue between exposed filters and contextual filters which the Views ...
Issue using Exposed filters along with contextual filters in views
I have a view page listing my stories/articles. I have a contextual filter based on the field Country which is a taxonomy term reference field. I have defined the path of the page as article-search/% to accommodate the contextual filter value. I have an exposed filter on the field article-category which is also of type taxonomy term reference. I us...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.