diff --git a/content_close.module b/content_close.module
index c2fbaaf..c46fe31 100644
--- a/content_close.module
+++ b/content_close.module
@@ -42,7 +42,7 @@ function content_close_form_alter(&$form, FormStateInterface $form_state, $form_
       $url = Url::fromRoute('content_close.page', ['time' => $time, 'content_type' => $content_type])->toString();
       $response = new RedirectResponse($url);
       $response->send();
-      drupal_set_message(t('The content creation for this content type is expired'), 'error', TRUE);
+      \Drupal::messenger()->addError(t('The content creation for this content type is expired'), TRUE);
     }
   }
 }
