=== Developer Debug Mode ===
Contributors: glimbyte
Donate link: https://glimbyte.ie
Tags: debug, wp-config, error log, developer tools, troubleshooting
Requires at least: 5.0
Tested up to: 6.9
Requires PHP: 7.0
Stable tag: 1.2.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Toggle WordPress debug mode instantly. No wp-config.php editing needed. Features auto-save, admin bar quick toggle, and debug log viewer.

== Description ==

**Stop editing wp-config.php every time you need to debug your WordPress site.**

Developer Debug Mode lets you toggle all WordPress debug constants directly from your dashboard with beautiful toggle switches. Changes save automatically — no clicking save buttons, no FTP access needed, no risk of syntax errors in your config file.

= 🎯 The Problem This Plugin Solves =

Every WordPress developer knows the pain:

1. Something breaks on your site
2. You need to enable WP_DEBUG to see the error
3. You open FTP/File Manager, find wp-config.php, edit it carefully
4. Debug the issue
5. Remember to turn debug off before visitors see ugly error messages
6. Repeat next time something breaks

**Developer Debug Mode eliminates steps 2-5 entirely.** Toggle debug on, find the error, toggle off. Done in seconds.

= ✨ Key Features =

**One-Click Debug Toggles**
Control all six WordPress debug constants from a clean, modern interface:

* **WP_DEBUG** — Master switch for WordPress debugging
* **WP_DEBUG_LOG** — Save errors to wp-content/debug.log
* **WP_DEBUG_DISPLAY** — Show errors on screen (careful on production!)
* **SCRIPT_DEBUG** — Use unminified core CSS/JS files
* **SAVEQUERIES** — Log database queries for performance analysis
* **WP_DISABLE_FATAL_ERROR_HANDLER** — See raw PHP fatal errors instead of recovery mode

**Admin Bar Quick Toggle** *(New in 1.2.0!)*
Toggle any debug constant directly from the WordPress admin bar — no need to visit the settings page. Perfect for quick debugging sessions.

**Built-in Debug Log Viewer**
View, search, download, and clear your debug.log without leaving WordPress:

* Color-coded entries (fatal, error, warning, notice)
* Search with highlighting
* Auto-refresh option for real-time monitoring
* One-click download and clear

**Auto-Save Technology**
Changes save instantly as you toggle. No save button, no page refresh, no waiting.

**Frontend Debug Warning**
A tasteful notification bar appears when WP_DEBUG_DISPLAY is active, reminding you to turn it off before visitors see error messages.

**Cross-Tab Synchronization**
Toggle debug in one browser tab and watch other open tabs update instantly.

**Automatic Backups**
Every change creates a backup of wp-config.php. The plugin keeps the 5 most recent backups, so you can always recover if something goes wrong.

= 🔧 Perfect For =

* **Theme developers** debugging template issues
* **Plugin developers** testing new code
* **Site administrators** troubleshooting problems
* **Agencies** managing multiple client sites
* **Freelancers** who need quick debugging without FTP access
* **Anyone** tired of manually editing wp-config.php

= 💡 Why Choose Developer Debug Mode? =

Unlike other debug plugins, we focus on **user experience**:

✅ **Instant toggles** — No save buttons, changes apply immediately
✅ **Visual feedback** — Clear status indicators show exactly what's enabled
✅ **Admin bar access** — Toggle debug from anywhere in WordPress
✅ **Production-safe** — Frontend warnings prevent accidentally exposing errors
✅ **Modern design** — Beautiful UI that fits naturally in your dashboard
✅ **Lightweight** — No bloat, loads only where needed

= 🔒 Built With Security In Mind =

* Capability checks ensure only administrators can change settings
* Nonce verification on all AJAX requests
* Automatic wp-config.php backups before every change
* No data sent to external servers
* Clean uninstall removes all plugin data

= 📚 Debug Constants Explained =

Not sure what each constant does? Here's a quick guide:

**WP_DEBUG**
The master switch. When enabled, WordPress will display PHP errors, notices, and warnings. Required for the other debug constants to work.

**WP_DEBUG_LOG**
Saves all debug messages to `/wp-content/debug.log`. Essential for debugging issues that happen in the background (AJAX, cron jobs, REST API).

**WP_DEBUG_DISPLAY**
Shows errors directly on your web pages. Useful during development but **never enable on production** — it can expose sensitive information to visitors.

**SCRIPT_DEBUG**
Forces WordPress to use the development versions of core CSS and JavaScript files instead of minified versions. Helpful when debugging scripts.

**SAVEQUERIES**
Stores database queries in a global array for later analysis. Useful for identifying slow queries but adds overhead — disable when not needed.

**WP_DISABLE_FATAL_ERROR_HANDLER**
Disables WordPress's "recovery mode" so you see the actual PHP fatal error instead of "There has been a critical error on this website."

= 🤝 Support & Documentation =

Need help? We offer:

* **Free Support** — Post in the [WordPress.org support forum](https://wordpress.org/support/plugin/developer-debug-mode/)
* **Documentation** — Visit [glimbyte.ie](https://glimbyte.ie) for guides and tutorials
* **Express Support** — Fast turnaround for urgent issues via [glimbyte.ie/support](https://glimbyte.ie/support)

= 🌐 Works Great With =

* **Query Monitor** — Use alongside for deeper debugging
* **Debug Bar** — Compatible with Debug Bar and its add-ons
* **Any caching plugin** — Clear cache after toggling debug constants
* **Managed WordPress hosts** — Works on most hosts including Kinsta, WP Engine, SiteGround

== Installation ==

= Automatic Installation (Recommended) =

1. Go to **Plugins → Add New** in your WordPress admin
2. Search for "Developer Debug Mode"
3. Click **Install Now** then **Activate**
4. Go to **Settings → Debug Mode** to start debugging

= Manual Installation =

1. Download the plugin ZIP file
2. Go to **Plugins → Add New → Upload Plugin**
3. Choose the ZIP file and click **Install Now**
4. Activate the plugin
5. Go to **Settings → Debug Mode**

= Requirements =

* WordPress 5.0 or higher
* PHP 7.0 or higher
* Write access to wp-config.php (most hosts allow this)

= After Activation =

1. Navigate to **Settings → Debug Mode**
2. You'll see the current status of all debug constants
3. Toggle any switch to enable/disable that constant
4. Changes save automatically — no save button needed!

== Frequently Asked Questions ==

= Does this plugin edit my wp-config.php file? =

Yes. The plugin modifies wp-config.php to add or update debug constant definitions. This is the same thing you would do manually, just automated and safer because:

* A backup is created before every change
* The plugin keeps the 5 most recent backups
* Changes are validated before saving
* No risk of syntax errors from manual editing

= Is it safe to use on a production/live site? =

The plugin itself is completely safe. However, be careful with **WP_DEBUG_DISPLAY** on production sites — it can expose sensitive error information to visitors.

That's why the plugin shows a frontend warning bar when WP_DEBUG_DISPLAY is active. You'll never forget to turn it off!

For production debugging, we recommend enabling only **WP_DEBUG** and **WP_DEBUG_LOG**, then checking the debug.log file.

= What if wp-config.php is not writable? =

The plugin will show a warning message and disable the toggle switches. You'll need to:

1. Contact your hosting provider to enable write access, or
2. Temporarily change file permissions to 644 or 664

Some managed WordPress hosts restrict wp-config.php access for security. Contact your host's support for help.

= Can I use this with Query Monitor or Debug Bar? =

Absolutely! Developer Debug Mode manages the debug constants, while Query Monitor and Debug Bar provide additional debugging interfaces. They complement each other perfectly.

= Will enabling debug mode slow down my site? =

**WP_DEBUG** and **WP_DEBUG_LOG** have minimal performance impact.

**WP_DEBUG_DISPLAY** can slightly slow page rendering if there are many errors.

**SAVEQUERIES** does add overhead because it stores every database query — disable it when not actively debugging database performance.

= How do I view the debug.log file? =

Three options:

1. **Built-in viewer** — Go to Settings → Debug Mode and scroll to the Debug Log Viewer section
2. **Direct access** — Download from /wp-content/debug.log via FTP
3. **Admin bar** — Click the debug log link in the admin bar menu

= Can I toggle debug from the admin bar? =

Yes! As of version 1.2.0, you can click any constant in the admin bar dropdown to toggle it on/off instantly. No need to visit the settings page.

= Does it work with WordPress Multisite? =

Yes! The plugin works on multisite installations. Each site administrator can manage debug settings for their site. Network-wide settings are not currently supported but planned for a future version.

= What happens when I deactivate or uninstall the plugin? =

**Deactivation:** Debug constants remain in wp-config.php at their current values.

**Uninstall:** Plugin options are removed from the database. Debug constants in wp-config.php are NOT removed — we don't want to accidentally disable debugging you intentionally enabled.

= Can I customize which constants are shown? =

Not currently, but this is planned for a future version. All six constants are shown by default as they're the most commonly used for debugging.

= The toggles aren't saving. What's wrong? =

This usually means one of:

1. **wp-config.php isn't writable** — Check file permissions
2. **JavaScript error** — Check browser console for errors
3. **Caching** — Clear any caching plugins and try again
4. **Security plugin conflict** — Temporarily disable security plugins to test

= Does this work with custom wp-config.php locations? =

Yes! The plugin checks both the standard location (WordPress root) and one directory up (common on some hosts).

= How do I get support? =

1. Check this FAQ first
2. Search the [support forum](https://wordpress.org/support/plugin/developer-debug-mode/) for similar issues
3. Create a new support topic with details about your problem
4. For urgent issues, contact us at [glimbyte.ie/support](https://glimbyte.ie/support)

== Screenshots ==

1. Clean, modern settings page with real-time status indicators showing all debug constants at a glance
2. Beautiful toggle switches with auto-save — changes apply instantly without clicking save
3. Admin bar quick toggle menu — enable or disable any debug constant from anywhere in WordPress
4. Built-in debug log viewer with search, color-coding, and one-click download
5. Frontend debug warning bar reminds you when WP_DEBUG_DISPLAY is active
6. Cross-tab synchronization keeps all your browser tabs in sync

== Changelog ==

= 1.2.5 =
* Fixed: Converted email templates to use fully inline styles instead of style blocks (WordPress.org compliance)
* Improved: Email compatibility across all major email clients

= 1.2.4 =
* Fixed: Removed Plugin URI to resolve duplicate URI error (Plugin URI and Author URI cannot be the same)

= 1.2.3 =
* Fixed: Plugin URI now points to valid URL (https://glimbyte.ie)
* Fixed: Inline styles now use wp_add_inline_style() instead of direct output (WordPress.org compliance)
* Fixed: JavaScript object names now use consistent dev_debug_mode prefix
* Improved: Code compliance with WordPress coding standards

= 1.2.2 =
* Fixed: Translators comments now properly placed directly above each __() call with placeholders
* Fixed: Updated "Tested up to" to WordPress 6.9
* Fixed: Shortened plugin short description to comply with 150 character limit

= 1.2.1 =
* Fixed: Added missing translators comments for i18n compliance (WordPress plugin check)

= 1.2.0 =
* Added: Admin bar quick toggle — click any constant to toggle it directly without visiting settings
* Added: Visual feedback with hover effects and loading states in admin bar
* Added: Real-time notifications when toggling from admin bar
* Added: Cross-tab synchronization for admin bar toggles
* Improved: Admin bar menu now shows "Click to Toggle" header for clarity
* Improved: Better visual distinction between enabled and disabled states

= 1.1.0 =
* Added: Admin bar menu showing debug status and quick access to settings
* Added: Built-in debug log viewer with search, download, and clear functionality
* Added: SAVEQUERIES toggle for database query logging
* Added: WP_DISABLE_FATAL_ERROR_HANDLER toggle (WSOD Override)
* Added: Auto-refresh option for log viewer
* Added: Color-coded log entries (fatal, error, warning, notice)
* Improved: Status grid now shows all 6 debug constants
* Improved: Better responsive design for mobile devices

= 1.0.1 =
* Fixed: WordPress 5.0+ compatibility issue with multisite uninstall

= 1.0.0 =
* Initial release
* Toggle WP_DEBUG, WP_DEBUG_LOG, WP_DEBUG_DISPLAY, SCRIPT_DEBUG
* Auto-save functionality with instant feedback
* Real-time status indicators
* Frontend debug notice when WP_DEBUG_DISPLAY is active
* Cross-tab synchronization via localStorage
* Automatic wp-config.php backups (keeps 5 most recent)
* Built-in support contact form

== Upgrade Notice ==

= 1.2.3 =
WordPress.org compliance fixes. Recommended update for all users preparing for plugin directory submission.

= 1.2.1 =
Minor fix for WordPress plugin check compliance. Recommended update for all users.

= 1.2.0 =
New admin bar quick toggle! Toggle debug constants directly from the admin bar without visiting settings. Highly recommended upgrade.

= 1.1.0 =
Major feature release: Admin bar menu, built-in debug log viewer, SAVEQUERIES and WSOD Override toggles. Recommended for all users.

= 1.0.1 =
Compatibility fix for WordPress 5.0+ multisite installations.

= 1.0.0 =
Initial release. The easiest way to manage WordPress debug settings!

== Credits ==

Developed with ❤️ by [Glimbyte](https://glimbyte.ie) — WordPress Development & Support.

Special thanks to the WordPress community for feedback and suggestions.

== Privacy Policy ==

Developer Debug Mode does not collect, store, or transmit any personal data. All settings are stored locally in your WordPress database and wp-config.php file.

The optional support contact form (available in the plugin settings) sends data directly to Glimbyte's support team. This data is handled according to [Glimbyte's Privacy Policy](https://glimbyte.ie/privacy).

== Additional Info ==

= Contribute =

Found a bug or have a feature request? We'd love to hear from you!

* **Support Forum:** [wordpress.org/support/plugin/developer-debug-mode](https://wordpress.org/support/plugin/developer-debug-mode/)
* **Website:** [glimbyte.ie](https://glimbyte.ie)

= Translations =

Want to help translate Developer Debug Mode into your language? Visit [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/developer-debug-mode/) to contribute.
