Removing Invalid Query String Parameter Issue in Drupal 9

A recent blog article by ComputerMinds discusses an issue many Drupal sites face. Drupal site administrators might have noticed many log messages saying, ‘An illegal choice has been detected. Please contact the site administrator.’ The author, Ross Bale, shares his experience with this problem in the blog post.

According to the article, the author and his team faced this issue on a Drupal site that was upgraded from Drupal 7 to Drupal 9. That site had a product search that was built using views. Compared to Drupal 7, the view and facets in Drupal 9 differ slightly. It resulted in somewhat different URLs being used when the user filters the search results. But the search engines that had indexed the older URLs from the Drupal 7 site regularly crawled the search page using the older links. This results in hundreds or thousands of log messages, as mentioned above.

According to the blog post, this problem can be easily solved using hook_views_pre_build(). The article also portrays the code that can be integrated to solve the issue. Read the blog post to know more.

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please let us know in the comments below and we will try to address the issue as best we can.

Related People

Related Organizations

Advertisement Here

Upcoming Events

Latest Opportunities

Advertisement Here