diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 428f16b..2fcf327 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -302,7 +302,7 @@ function rdf_preprocess_node(&$variables) {
     // In full node view, the number of comments is not displayed by
     // node.html.twig so it is expressed in RDFa in the <head> tag of the HTML
     // page.
-    if ($variables['page'] && user_access('access comments')) {
+    if ($variables['page'] && Drupal::currentUser()->hasPermission('access comments')) {
       $element = array(
         '#tag' => 'meta',
         '#attributes' => array(
