A WordPress plugin designed to sanitize and enhance local development environments. Prevents accidental email sends, proxies media files from production, and provides visual indicators to ensure you're always aware you're working in a development environment.
Prevents all outgoing emails from being sent in your local development environment. This ensures you never accidentally send test emails to real users or customers.
Automatically replaces local media URLs with production URLs, allowing you to work without maintaining a local copy of wp-content/uploads/. This saves disk space and ensures you're always viewing production-quality media.
Displays a prominent red warning banner at the bottom of both the WordPress admin and frontend, clearly indicating you're in a development environment.
Shows a confirmation dialog when clicking links that point to your production site, preventing accidental navigation away from your development environment. Other external links work normally without confirmation.
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Download or clone this repository into your
wp-content/plugins/directory alternately via the WP-CLI, runwp plugin install https://github.com/SoleGraphics/sole-dev-wp/archive/refs/heads/main.zip --activate - Activate the plugin through the WordPress admin 'Plugins' menu
The plugin automatically activates when:
- Your site's hostname contains
.test(e.g.,mysite.test)
To enable the plugin on non-.test domains, add the following to your wp-config.php:
define('SOLE_DEV_ENVIRONMENT', true);To enable media proxying, define your production URL and enable the proxy in wp-config.php:
define('SOLE_DEV_PROXY_URL', 'https://your-production-site.com');
define('SOLE_DEV_PROXY_ENABLED', true);Note: The Media Proxy and Link Confirmation features require both constants to be defined and truthy. If either is missing or false, those features will be disabled.
- Type: Boolean
- Default: Not defined
- Description: Manually enables the plugin on non-
.testdomains. Set totrueto activate. - Location:
wp-config.php
- Type: String (URL)
- Default: Not defined
- Description: The production site URL used for media proxying and link confirmation. Must be a full URL including protocol (e.g.,
https://example.com). - Location:
wp-config.php - Required for: Media Proxy and Link Confirmation features
- Type: Boolean
- Default: Not defined
- Description: Enables the media proxy and link confirmation features. Must be set to
truealong withSOLE_DEV_PROXY_URLfor these features to work. - Location:
wp-config.php - Required for: Media Proxy and Link Confirmation features
- Intercepts all
wp_mail()calls and prevents them from sending - Clears all recipients from PHPMailer as a secondary safety measure
- Filters WordPress attachment URLs, image sources, content URLs, and responsive image srcsets
- Replaces local site URLs with production URLs for all media references
- Adds a fixed-position banner at the bottom of all pages
- Automatically adds bottom margin to the body to prevent content from being hidden
- Uses JavaScript to detect clicks on links pointing to the production domain
- Shows a browser confirmation dialog before allowing navigation
- Only affects links to the production site; other external links work normally
sole-dev-wp/
├── sole-dev.php # Main plugin file
├── class-email-disabler.php # Email disabler module
├── class-media-proxy.php # Media proxy module
├── class-dev-warning.php # Dev warning banner module
├── class-link-confirmation.php # Link confirmation module
└── README.md # This file
The plugin follows WordPress coding standards and uses a modular class-based architecture for easy maintenance and extensibility.
This plugin is provided as-is for development use.
Contributions are welcome! Please ensure your code follows WordPress coding standards and includes appropriate documentation.
- Initial release
- Email disabler functionality
- Media proxy functionality
- Dev environment warning banner
- Link confirmation for production URLs