diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
index a16c02562e..672802b6df 100644
--- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
@@ -1347,7 +1347,7 @@ public function convertExposedInput(&$input, $selected_group_id = NULL) {
 
         // Value can be optional, For example for 'empty' and 'not empty' filters.
         if (isset($this->options['group_info']['group_items'][$selected_group]['value']) && $this->options['group_info']['group_items'][$selected_group]['value'] !== '') {
-          $input[$this->options['expose']['identifier']] = $this->options['group_info']['group_items'][$selected_group]['value'];
+          $input[$this->options['group_info']['identifier']] = $this->options['group_info']['group_items'][$selected_group]['value'];
         }
         $this->options['expose']['use_operator'] = TRUE;
 
@@ -1439,7 +1439,12 @@ public function acceptExposedInput($input) {
     }
 
     if (!empty($this->options['expose']['identifier'])) {
-      $value = $input[$this->options['expose']['identifier']];
+      if ($this->options['is_grouped']) {
+        $value = $input[$this->options['group_info']['identifier']];
+      }
+      else {
+        $value = $input[$this->options['expose']['identifier']];
+      }
 
       // Various ways to check for the absence of non-required input.
       if (empty($this->options['expose']['required'])) {
diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
index b7b76cef97..bb102006d2 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
@@ -164,6 +164,39 @@ public function testFilterNotInOperatorGroupedExposedSimple() {
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
+  /**
+   * Tests that we can safely change the identifier on a grouped filter.
+   */
+  public function testFilterGroupedChangedIdentifier() {
+    $filters = $this->getGroupedExposedFilters();
+    $view = Views::getView('test_view');
+
+    $filters['age']['group_info']['default_group'] = 2;
+    $filters['age']['group_info']['identifier'] = 'not-age';
+    $view->setDisplay();
+    $view->displayHandlers->get('default')->overrideOption('filters', $filters);
+
+    $this->executeView($view);
+
+    $expected_result = [
+      [
+        'name' => 'John',
+        'age' => 25,
+      ],
+      [
+        'name' => 'George',
+        'age' => 27,
+      ],
+      [
+        'name' => 'Ringo',
+        'age' => 28,
+      ],
+    ];
+
+    $this->assertEquals(3, count($view->result));
+    $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
+  }
+
   protected function getGroupedExposedFilters() {
     $filters = [
       'age' => [
