---
title: "Use safe mode to recover from a snippet that locks you out - Code Snippets"
description: "Locked out by a broken snippet? One line in configuration.php pauses every snippet so you can get back in, fix it and switch them on again."
url: "https://www.tassos.gr/docs/code-snippets/troubleshooting/safe-mode"
date: "2026-10-22T23:48:56+00:00"
language: "en-GB"
---

[ Home ](https://www.tassos.gr/docs) / [ Code Snippets ](https://www.tassos.gr/docs/code-snippets) / [ Troubleshooting ](https://www.tassos.gr/docs/code-snippets/troubleshooting)

#  Use safe mode to recover from a snippet that locks you out

##  Locked out by a broken snippet? One line in configuration.php pauses every snippet so you can get back in, fix it and switch them on again.

Code Snippets disables a PHP snippet on its own when it throws an error or causes a fatal error, so the next page load works. A few things slip through: an `exit()` in the wrong place, a loop that waits on a slow HTTP call, or a snippet that keeps redirecting you away from the administrator. If one of those locks you out, safe mode is the way back in.

## [What safe mode does](#what-safe-mode-does)

While safe mode is on, no snippet runs, on the site or in the administrator, and shortcodes stay as they are. Snippets keep their status, so when you turn safe mode off everything runs as before.

The component's own pages show a warning while safe mode is on, so the line in `configuration.php` doesn't get forgotten. Other administrator pages show nothing.

Safe mode is a file edit on purpose. A URL parameter would let any visitor switch off the snippets that protect your administrator, like an IP allowlist or a login block.

## [Turn safe mode on](#turn-safe-mode-on)

1. Open `configuration.php` in your site's root folder, over FTP or your host's file manager.
2. Add this line inside the `JConfig` class, next to the other `public` properties:

     ```
    public $tcs_safe_mode = true;
    ```
3. Save the file.
4. Log into your Joomla backend.
5. Go to **Components** → **Tassos Code Snippets**. A warning at the top of the page confirms that safe mode is on.

Give it a few seconds. PHP keeps a cached copy of `configuration.php` and rechecks it every couple of seconds on most hosts.

A constant works too. Put it above the `class JConfig` line:

 ```
define('TCS_SAFE_MODE', true);
```

 Joomla rewrites configuration.php whenever you save the Global Configuration. The property survives that rewrite, the constant doesn't.

## [Fix the snippet](#fix-the-snippet)

1. In the snippets list, look for a snippet with the **Auto-Disabled** status, or for the one you published last.
2. Open it. An auto-disabled snippet shows the error message, the stack trace and the error date at the top of the edit screen.
3. Fix the code, or set its **Status** to **Unpublished** for now.
4. Click **Save & Close**.

Not sure which snippet it was? Filter the list by **Location** and start with the PHP snippets on Admin Page Load or Site and Admin Page Load, since those run on every administrator request.

## [Turn safe mode off](#turn-safe-mode-off)

1. Remove the line you added from `configuration.php`.
2. Save the file.
3. Reload the administrator. The warning is gone and your snippets run again.

The [PHP snippet docs](https://www.tassos.gr/docs/code-snippets/types/php) explain how snippets get disabled on errors. If a snippet fails without locking you out, [How to debug PHP errors in a snippet](https://www.tassos.gr/docs/code-snippets/troubleshooting/debug-php-errors) shows where to read the error.

 Last updated on Oct 19th 2026 10:10
