diff --git a/core/includes/form.inc b/core/includes/form.inc
index 395cca7..9f9bd31 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -2155,6 +2155,10 @@ function _form_button_was_clicked($element, &$form_state) {
  *   submitted form values; altered by reference.
  */
 function form_state_values_clean(&$form_state) {
+  // Allow modules to clean up their internal values. Do this first, so they can
+  // access form_id and other Form API internals.
+  drupal_alter('form_state_values_clean', $form_state);
+
   // Remove internal Form API values.
   unset($form_state['values']['form_id'], $form_state['values']['form_token'], $form_state['values']['form_build_id'], $form_state['values']['op']);
 
diff --git a/core/modules/node/content_types.inc b/core/modules/node/content_types.inc
index ede3777..2cc1d86 100644
--- a/core/modules/node/content_types.inc
+++ b/core/modules/node/content_types.inc
@@ -348,6 +348,7 @@ function node_type_form_submit($form, &$form_state) {
     return;
   }
 
+  form_state_values_clean($form_state);
   $variables = $form_state['values'];
 
   // Remove everything that's been saved already - whatever's left is assumed
@@ -358,8 +359,6 @@ function node_type_form_submit($form, &$form_state) {
     }
   }
 
-  unset($variables['form_token'], $variables['op'], $variables['submit'], $variables['delete'], $variables['reset'], $variables['form_id'], $variables['form_build_id']);
-
   // Save or reset persistent variable values.
   foreach ($variables as $key => $value) {
     $variable_new = $key . '_' . $type->type;
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 2223dec..ae2a01f 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -1395,6 +1395,33 @@ function hook_forms($form_id, $args) {
 }
 
 /**
+ * Clean submitted form values before they are processed further.
+ *
+ * This hook is invoked from form_state_values_clean() before Form API removes
+ * its internal values from the submitted form values.
+ *
+ * It is typically used to clean up temporary, module-specific values from
+ * $form_state['values'] by removing them entirely, or by moving them into
+ * another location (e.g., $form_state['temporary']), to prevent them from being
+ * cached or processed by the form's primary submit handler.
+ *
+ * @param array $form_state
+ *   The current state of the form, containing all submitted form values.
+ *   Passed by reference.
+ */
+function hook_form_state_values_clean_alter(&$form_state) {
+  if ($form_state['values']['form_id'] == 'example_form') {
+    // Remove our temporary value, if it exists.
+    if (isset($form_state['values']['example'])) {
+      // Leverage Form API's special $form_state['temporary'] storage to
+      // prevent the values from being cached.
+      $form_state['temporary']['example'] = $form_state['values']['example'];
+      unset($form_state['values']['example']);
+    }
+  }
+}
+
+/**
  * Perform setup tasks for all page requests.
  *
  * This hook is run at the beginning of the page request. It is typically
