diff --git a/core/includes/common.inc b/core/includes/common.inc
index 3d245a0..bf896c1 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1526,11 +1526,7 @@ function _drupal_add_js($data = NULL, $options = NULL) {
           $current_query = \Drupal::service('request_stack')->getCurrentRequest()->query->all();
           url('', array('script' => &$scriptPath, 'prefix' => &$pathPrefix));
           $current_path = current_path();
-          $current_path_is_admin = FALSE;
-          // The function path_is_admin() is not available on update.php pages.
-          if (!(defined('MAINTENANCE_MODE'))) {
-            $current_path_is_admin = \Drupal::service('router.admin_context')->isAdminRoute();
-          }
+          $current_path_is_admin = \Drupal::service('router.admin_context')->isAdminRoute();
           $path = array(
             'basePath' => base_path(),
             'scriptPath' => $scriptPath,
diff --git a/core/includes/path.inc b/core/includes/path.inc
index b0cc2fe..5b4576b 100644
--- a/core/includes/path.inc
+++ b/core/includes/path.inc
@@ -68,31 +68,3 @@ function current_path() {
   // _current_path().
   return _current_path();
 }
-
-/**
- * Determines whether a path is in the administrative section of the site.
- *
- * By default, paths are considered to be non-administrative. If a path does
- * not match any of the patterns in path_get_admin_paths(), or if it matches
- * both administrative and non-administrative patterns, it is considered
- * non-administrative.
- *
- * @param $path
- *   A Drupal path.
- *
- * @return
- *   TRUE if the path is administrative, FALSE otherwise.
- *
- * @deprecated Use \Drupal::service('router.admin_context')->isAdminRoute()
- *   service instead.
- */
-function path_is_admin($path) {
-  try {
-    $parameters = \Drupal::service('router')->match('/' . $path);
-    $route = $parameters[RouteObjectInterface::ROUTE_OBJECT];
-    return \Drupal::service('router.admin_context')->isAdminRoute($route);
-  }
-  catch (ParamNotConvertedException $e) {
-    return FALSE;
-  }
-}
diff --git a/core/modules/block/src/Controller/BlockController.php b/core/modules/block/src/Controller/BlockController.php
index a4e7952..0749081 100644
--- a/core/modules/block/src/Controller/BlockController.php
+++ b/core/modules/block/src/Controller/BlockController.php
@@ -61,9 +61,10 @@ public function demo($theme) {
         'js' => array(
           array(
             // The block demonstration page is not marked as an administrative
-            // page by path_is_admin() function in order to use the frontend
-            // theme. Since JavaScript relies on a proper separation of admin
-            // pages, it needs to know this is an actual administrative page.
+            // page by \Drupal::service('router.admin_context')->isAdminRoute()
+            // function in order to use the frontend theme. Since JavaScript
+            // relies on a proper separation of admin pages, it needs to know
+            // this is an actual administrative page.
             'data' => array('path' => array('currentPathIsAdmin' => TRUE)),
             'type' => 'setting',
           )
