Title: NaveenCodes Safe Mode
Author: Naveen Goyal
Published: <strong>2026 年 6 月 19 日</strong>
Last modified: 2026 年 6 月 30 日

---

搜尋外掛

![](https://ps.w.org/naveencodes-safe-mode/assets/banner-772x250.png?rev=3578067)

![](https://ps.w.org/naveencodes-safe-mode/assets/icon-256x256.png?rev=3578067)

# NaveenCodes Safe Mode

 由 [Naveen Goyal](https://profiles.wordpress.org/shinu1503/) 開發

[下載](https://downloads.wordpress.org/plugin/naveencodes-safe-mode.1.1.0.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/naveencodes-safe-mode/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/naveencodes-safe-mode/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/naveencodes-safe-mode/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/naveencodes-safe-mode/#developers)

 [技術支援](https://wordpress.org/support/plugin/naveencodes-safe-mode/)

## 外掛說明

NaveenCodes Safe Mode helps restore access after fatal plugin or theme crashes. 
It detects fatal PHP shutdown errors, identifies whether the source is a plugin 
or theme, performs the configured recovery action, records detailed logs, stores
recovery history, shows persistent admin notices, and emails administrators.

The plugin does not modify, rewrite, or repair user code. Version 1 is focused only
on detection, disabling, recovery, logging, and notification.

### Version 1 Architecture

 * Namespace: `NaveenCodes\SafeMode`
 * Prefix: `ncsm_`
 * Text domain: `naveencodes-safe-mode`
 * Bootstrap: `naveencodes-safe-mode.php`
 * Autoloading: lightweight PSR-4 style autoloader for `includes/`
 * Composition root: `includes/Core/Plugin.php`
 * Service boundaries:
    - `Core`: activation, deactivation, settings, plugin bootstrapping
    - `Database`: custom table schema
    - `Recovery`: shutdown detection, source detection, queueing, plugin/theme recovery,
      notifications
    - `Logging`: error logs and recovery history persistence
    - `Admin`: dashboard, logs, history, settings, notices, coming soon UI
    - `Helpers`: focused WordPress helper utilities
    - `Interfaces`: shared service contracts

### Database Schema

    ```
    wp_ncsm_logs
    ```

 * `id`
 * `timestamp`
 * `error_type`
 * `error_message`
 * `file_path`
 * `line_number`
 * `source_type`
 * `source_name`
 * `action_taken`
 * `recovery_status`
 * wp_ncsm_recovery_history
 * `id`
 * `timestamp`
 * `source_type`
 * `source_name`
 * `recovery_action`
 * `recovery_result`

### Recovery Workflow

 1.  Register a shutdown function early on `plugins_loaded`.
 2.  Inspect `error_get_last()` on shutdown.
 3.  Continue only for fatal, parse, compile, core, user, or recoverable fatal errors.
 4.  Detect source from the error file path:
 5.   * `wp-content/plugins/...` becomes a plugin source.
      * `wp-content/themes/...` becomes a theme source.
      * Anything else is stored as Unknown Source.
 6.  Check recovery queue attempts for the source.
 7.  If the source is a plugin and plugin auto-disable is enabled, deactivate the faulty
     plugin.
 8.  If the source is the active theme and theme recovery is enabled, switch to the
     configured fallback theme.
 9.  Log the error and recovery action.
 10. Store recovery history.
 11. Add a persistent admin notice.
 12. Send an administrator email when enabled.

### WordPress Hooks

 * `plugins_loaded` boots the plugin.
 * `register_shutdown_function()` detects fatal shutdown errors.
 * `admin_menu` registers the admin pages.
 * `admin_enqueue_scripts` loads admin assets.
 * `admin_notices` renders persistent recovery notices.
 * `admin_post_ncsm_save_settings` saves settings.
 * `admin_post_ncsm_export_logs` exports logs.
 * `admin_post_ncsm_dismiss_notice` dismisses recovery notices.

### Admin Pages

 * Dashboard: protection status, statistics, recovery workflow, and theme snapshot
   status.
 * Error Logs: fatal error log table, filters, and CSV export.
 * Recovery History: source, action, result, and timestamp.
 * Theme Snapshot: take, replace, restore, or delete the active theme backup.
 * Settings: recovery toggles, notifications, fallback theme, retention, maximum
   attempts.
 * Coming Soon: planned feature previews only.

### Settings

 * Enable Recovery
 * Enable Plugin Auto Disable
 * Enable Theme Recovery
 * Enable Email Notifications
 * Fallback Theme Selector
 * Log Retention Period
 * Maximum Recovery Attempts

### Coming Soon

The following features are displayed as UI-only cards and are not implemented in
Version 1:

 * Automatic Rollback
 * Update Sandbox Testing
 * Code Snippet Protection
 * AI Error Analysis
 * Slack Notifications
 * Cloud Backups
 * Uptime Monitoring
 * One Click Restore

### Security

Version 1 uses capability checks, nonces, sanitization, escaping, WordPress database
APIs, and prepared SQL for dynamic values. It performs no tracking, no hidden data
collection, no remote code execution, and no unsafe file rewriting.

## 螢幕擷圖

[⌊Admin notice shown after automatic recovery — confirms what failed and what action
was taken.⌉⌊Admin notice shown after automatic recovery — confirms what failed and
what action was taken.⌉[

Admin notice shown after automatic recovery — confirms what failed and what action
was taken.

[⌊Error Logs — filterable table of every fatal error with source, file, line, and
recovery status.⌉⌊Error Logs — filterable table of every fatal error with source,
file, line, and recovery status.⌉[

Error Logs — filterable table of every fatal error with source, file, line, and 
recovery status.

[⌊Recovery History — chronological record of every recovery action and its outcome.⌉⌊
Recovery History — chronological record of every recovery action and its outcome
.⌉[

Recovery History — chronological record of every recovery action and its outcome.

[⌊Settings — toggle recovery, auto-disable, theme fallback, email notifications,
and retention controls.⌉⌊Settings — toggle recovery, auto-disable, theme fallback,
email notifications, and retention controls.⌉[

Settings — toggle recovery, auto-disable, theme fallback, email notifications, and
retention controls.

## 安裝方式

 1. Upload the `naveencodes-safe-mode` folder to `/wp-content/plugins/`.
 2. Activate the plugin from the WordPress Plugins screen.
 3. Go to Safe Mode > Settings and choose a fallback theme.

## 常見問題集

### Does this plugin fix broken PHP code?

No. It only detects fatal errors, disables faulty plugins or switches broken themes,
logs what happened, and notifies administrators.

### Can it recover from every crash?

No recovery plugin can guarantee recovery from all fatal errors. WordPress must 
load NaveenCodes Safe Mode before the crash occurs so its shutdown handler can run.

### Does Version 1 include rollback or AI analysis?

No. Those appear only in the Coming Soon section.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈NaveenCodes Safe Mode〉的開發相關工作。

參與者

 *   [ Naveen Goyal ](https://profiles.wordpress.org/shinu1503/)

[將〈NaveenCodes Safe Mode〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/naveencodes-safe-mode)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/naveencodes-safe-mode/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/naveencodes-safe-mode/)，或透過
[RSS](https://plugins.trac.wordpress.org/log/naveencodes-safe-mode/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/naveencodes-safe-mode/)。

## 變更記錄

#### 1.1.0

 * Added: Theme Snapshot — copies the active theme (and parent if child theme) to
   a backup folder on activation. If the active theme causes a fatal error, Safe
   Mode automatically switches to the snapshot backup instead of the generic fallback
   theme.
 * Added: Theme Snapshot admin page (Safe Mode › Theme Snapshot) — shows snapshot
   status, taken-at date, backup folder name. Buttons to take, replace, restore,
   or delete the snapshot.
 * Added: Snapshot status panel on the Dashboard — shows at a glance whether a snapshot
   is ready, active (after a crash), or missing.
 * Added: “Restore Original Theme” button in recovery admin notices — appears when
   the snapshot backup is the currently active theme after a crash.
 * Added: Child theme support — when the active theme is a child theme, the parent
   theme is also backed up and the child backup’s Template header is updated to 
   point to the parent backup.

#### 1.0.3

 * Added: Review request notice — shown after 7 days of active use, with options
   to review on WordPress.org, mark as already reviewed, or snooze for 14 days. 
   Only one NaveenCodes notice appears per day across all plugins.

#### 1.0.2

 * Fixed: Plugin URI corrected to the WordPress.org plugin page — “View plugin” 
   now links correctly in the plugins list.

#### 1.0.1

 * Added: Maa tribute in the WP admin footer — shown on every Safe Mode screen, 
   matching all other NaveenCodes plugins.

#### 1.0.0

 * Initial Version 1 release.
 * Fatal error detection.
 * Plugin auto-disable recovery.
 * Theme fallback recovery.
 * Recovery queue and attempt limits.
 * Custom error logs and recovery history tables.
 * Admin dashboard, logs, history, settings, notices, email notifications, and Coming
   Soon UI.

## 中繼資料

 *  版本 **1.1.0**
 *  最後更新 **3 週前**
 *  啟用安裝數 **少於 10 次**
 *  WordPress 版本需求 ** 6.5 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.8.6**
 *  PHP 版本需求 ** 8.0 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/naveencodes-safe-mode/)
 * 標籤:
 * [fatal error](https://tw.wordpress.org/plugins/tags/fatal-error/)[recovery](https://tw.wordpress.org/plugins/tags/recovery/)
   [safe mode](https://tw.wordpress.org/plugins/tags/safe-mode/)
 *  [進階檢視](https://tw.wordpress.org/plugins/naveencodes-safe-mode/advanced/)

## 評分

這個項目尚無任何評論記錄。

[Your review](https://wordpress.org/support/plugin/naveencodes-safe-mode/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/naveencodes-safe-mode/reviews/)

## 參與者

 *   [ Naveen Goyal ](https://profiles.wordpress.org/shinu1503/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/naveencodes-safe-mode/)