8 February 2023

It's preferable to determine if the page is an admin page by checking the active theme, as it provides a comprehensive solution, rather than relying on the URL path. This approach assumes that the admin theme is distinct from the main site theme.

Source code viewer
  1. global $theme;
  2. if ($theme === variable_get('admin_theme', 'seven')) {
  3. // …
  4. }
Programming Language: PHP