diff --git a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
old mode 100644
new mode 100755
index fffe084..bd07f57
--- a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
+++ b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
@@ -158,19 +158,17 @@ public function query() {
     if (!empty($sort_by)) {
       // Make sure the original order of sorts is preserved
       // (e.g. a sticky sort is often first)
-      if (isset($view->sort[$sort_by])) {
-        $view->query->orderby = [];
-        foreach ($view->sort as $key => $sort) {
-          if (!$sort->isExposed()) {
-            $sort->query();
-          }
-          elseif ($key == $sort_by) {
-            if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], ['ASC', 'DESC'])) {
-              $sort->options['order'] = $exposed_data['sort_order'];
-            }
-            $sort->setRelationship();
-            $sort->query();
+      $view->query->orderby = [];
+      foreach ($view->sort as $key => $sort) {
+        if (!$sort->isExposed()) {
+          $sort->query();
+        }
+        elseif (!empty($sort->options['expose']['identifier']) && $sort->options['expose']['identifier'] == $sort_by) {
+          if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], ['ASC', 'DESC'])) {
+            $sort->options['order'] = $exposed_data['sort_order'];
           }
+          $sort->setRelationship();
+          $sort->query();
         }
       }
     }
@@ -206,16 +204,18 @@ public function exposedFormAlter(&$form, FormStateInterface $form_state) {
 
     // Check if there is exposed sorts for this view
     $exposed_sorts = [];
+    $exposed_sorts_options = [];
     foreach ($this->view->sort as $id => $handler) {
-      if ($handler->canExpose() && $handler->isExposed()) {
-        $exposed_sorts[$id] = Html::escape($handler->options['expose']['label']);
+      if ($handler->canExpose() && $handler->isExposed() && !empty($handler->options['expose']['identifier'])) {
+        $exposed_sorts[$handler->options['expose']['identifier']] = $id;
+        $exposed_sorts_options[$handler->options['expose']['identifier']] = Html::escape($handler->options['expose']['label']);
       }
     }
 
     if (count($exposed_sorts)) {
       $form['sort_by'] = [
         '#type' => 'select',
-        '#options' => $exposed_sorts,
+        '#options' => $exposed_sorts_options,
         '#title' => $this->options['exposed_sorts_label'],
       ];
       $sort_order = [
@@ -223,8 +223,8 @@ public function exposedFormAlter(&$form, FormStateInterface $form_state) {
         'DESC' => $this->options['sort_desc_label'],
       ];
       $user_input = $form_state->getUserInput();
-      if (isset($user_input['sort_by']) && isset($this->view->sort[$user_input['sort_by']])) {
-        $default_sort_order = $this->view->sort[$user_input['sort_by']]->options['order'];
+      if (isset($user_input['sort_by']) && isset($exposed_sorts[$user_input['sort_by']]) && isset($this->view->sort[$exposed_sorts[$user_input['sort_by']]])) {
+        $default_sort_order = $this->view->sort[$exposed_sorts[$user_input['sort_by']]]->options['order'];
       }
       else {
         $first_sort = reset($this->view->sort);
diff --git a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php
old mode 100644
new mode 100755
index a40dc34..89ec3cf
--- a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php
+++ b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php
@@ -47,6 +47,7 @@ protected function defineOptions() {
     $options['expose'] = [
       'contains' => [
         'label' => ['default' => ''],
+        'identifier' => ['default' => ''],
       ],
     ];
     return $options;
@@ -206,6 +207,58 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) {
       '#size' => 40,
       '#weight' => -1,
    ];
+
+   $form['expose']['identifier'] = [
+      '#type' => 'textfield',
+      '#default_value' => $this->options['expose']['identifier'],
+      '#title' => $this->t('Sort identifier'),
+      '#size' => 40,
+      '#description' => $this->t('This will appear in the URL after the ? to identify this sort. Cannot be blank. Only letters, digits and the dot ("."), hyphen ("-"), underscore ("_"), and tilde ("~") characters are allowed.'),
+    ];
+  }
+
+  /**
+   * Validate the options form.
+   */
+  public function validateExposeForm($form, FormStateInterface $form_state) {
+    $identifier = $form_state->getValue(['options', 'expose', 'identifier']);
+    $this->validateIdentifier($identifier, $form_state, $form['expose']['identifier']);
+  }
+
+  /**
+   * Validates a sort identifier.
+   *
+   * Sets the form error if $form_state is passed or a error string if
+   * $form_state is not passed.
+   *
+   * @param string $identifier
+   *   The identifier to check.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   * @param array $form_group
+   *   The form element to set any errors on.
+   *
+   * @return string
+   */
+  protected function validateIdentifier($identifier, FormStateInterface $form_state = NULL, &$form_group = []) {
+    $error = '';
+    if (empty($identifier)) {
+      $error = $this->t('The identifier is required if the sort is exposed.');
+    }
+    elseif ($identifier == 'value') {
+      $error = $this->t('This identifier is not allowed.');
+    }
+    elseif (preg_match('/[^a-zA-z0-9_~\.\-]/', $identifier)) {
+      $error = $this->t('This identifier has illegal characters.');
+    }
+
+    if ($form_state && !$this->view->display_handler->isIdentifierUnique($form_state->get('id'), $identifier)) {
+      $error = $this->t('This identifier is used by another handler.');
+    }
+
+    if (!empty($form_state) && !empty($error)) {
+      $form_state->setError($form_group, $error);
+    }
+    return $error;
   }
 
   /**
@@ -214,6 +267,7 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) {
   public function defaultExposeOptions() {
     $this->options['expose'] = [
       'label' => $this->definition['title'],
+      'identifier' => $this->options['id'],
     ];
   }
 
