A lightweight, secure WordPress plugin that displays a customizable Coming Soon page to non-logged-in users while maintaining proper HTTP status codes and SEO protection.
- β Clean Implementation: Minimal, well-documented codebase
- π Secure Preview Access: Time-safe key comparison for preview functionality
- π Admin Preview Mode: View Coming Soon page while logged in via admin bar button
- π― Proper HTTP Status: Returns 503 (Service Unavailable) with retry headers
- π« SEO Protection: Automatic noindex/nofollow headers
- π¨ Template Customization: Support for custom theme templates
- π₯ Admin-Friendly: Clear admin interface with persistent status warning
- β‘ Performance Optimized: Early exit strategies, no unnecessary processing
- π§ WordPress Best Practices: Uses standard APIs and hooks
- Copy
lr-coming-soon-page.phpto/wp-content/mu-plugins/ - The plugin activates automatically
- Configure via Settings β LR Coming Soon
- Copy
lr-coming-soon-page.phpto/wp-content/plugins/lr-coming-soon/ - Activate via Plugins menu
- Configure via Settings β LR Coming Soon
- Navigate to Settings β LR Coming Soon in WordPress admin
- Create a published page with your Coming Soon content
- Select the page from the dropdown
- Enable "Coming Soon Mode"
- (Optional) Set a preview key for sharing access
When Coming Soon mode is active, administrators can preview the Coming Soon page while logged in:
Option 1: Admin Bar Button
- Look for the "π Preview Coming Soon" button in the admin bar
- Click to see exactly what visitors see
- Only visible to users with
manage_optionscapability
Option 2: Direct URL
https://yoursite.com/?lr_preview_coming_soon=1
This allows you to test the Coming Soon page without logging out or using incognito mode.
- Active: Non-logged-in users see the Coming Soon page
- Inactive: Normal site operation
- Select any published page from your site
- This page's content will be displayed to visitors
- Must be published (drafts won't work)
- Optional secret key for bypassing Coming Soon mode
- Share with clients/stakeholders:
https://yoursite.com/?lr_preview=YOUR_KEY - Uses time-safe comparison (prevents timing attacks)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Request arrives β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββ
β Preview key? ββββYesβββ Show normal site
ββββββββββ¬ββββββββ
β No
βΌ
ββββββββββββββββββ
β Force preview? ββββYesβββ Show Coming Soon
β (admin only) β (even if logged in)
ββββββββββ¬ββββββββ
β No
βΌ
ββββββββββββββββββ
β Logged in? ββββYesβββ Show normal site
ββββββββββ¬ββββββββ
β No
βΌ
ββββββββββββββββββ
β Mode enabled? ββββNoββββ Show normal site
ββββββββββ¬ββββββββ
β Yes
βΌ
ββββββββββββββββββ
β Show Coming β
β Soon page β
ββββββββββββββββββ
The plugin never interferes with:
- Logged-in users
- Preview key holders
- Admin area
- AJAX requests
- Cron jobs
- RSS feeds
- REST API requests
When Coming Soon page is shown:
HTTP/1.1 503 Service Unavailable
X-Robots-Tag: noindex, nofollow
Retry-After: 86400
Cache-Control: no-cache, must-revalidate, max-age=0
The plugin searches for templates in this order:
coming-soon.php(theme root)templates/coming-soon.phpparts/page/coming-soon.php- Default fallback template
Create coming-soon.php in your theme root:
<?php
/**
* Custom Coming Soon Template
*/
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class('coming-soon'); ?>>
<?php while (have_posts()) : the_post(); ?>
<main class="coming-soon-content">
<?php the_content(); ?>
</main>
<?php endwhile; ?>
<?php wp_footer(); ?>
</body>
</html>The plugin works seamlessly with:
- Gutenberg blocks
- Elementor
- Beaver Builder
- Divi
- Any page builder
Just create your page normally and select it in the settings.
- Early Preview Check: Preview bypass is checked first with
hash_equals()for security - Guard Clauses: Multiple early returns prevent unnecessary processing
- Query Replacement: Swaps global
$wp_querycleanly without side effects - Template Hierarchy: Respects WordPress template system
- HTTP Compliance: Proper 503 status with retry-after headers
redirect_canonical- Disables canonical redirect for preview URLsadmin_menu- Registers settings pageadmin_init- Registers settingsadmin_notices- Shows active mode warningtemplate_redirect- Main interception logic
Perfect for sites under development that need to show a "Coming Soon" or "Under Construction" page while allowing:
- Developers (logged in) to work normally
- Client preview access via secret key
- Search engines to see maintenance status
Quick maintenance mode without heavy plugins. Set proper HTTP headers so search engines know it's temporary.
Share preview access with specific people before public launch using the preview key feature.
- β
Time-safe key comparison (
hash_equals) - β Input sanitization on all settings
- β
Capability checks (
manage_options) - β
Nonce verification (WordPress handles via
options.php) - β Page status validation (must be published)
- β Direct access prevention
- Minimal overhead: Early exits prevent unnecessary processing
- No database queries: Uses cached options
- No external dependencies: Pure WordPress core
- Template caching: Respects WordPress template caching
- Query cleanup: Restores original query state
- Verify mode is enabled in settings
- Check selected page is published
- Test in incognito/private window (you might be logged in)
- Clear WordPress cache if using caching plugin
- Verify key is saved in settings (check for typos)
- Use exact URL format:
?lr_preview=YOUR_KEY - Check that canonical redirect filter is working
- Check file exists in theme directory
- Verify file name matches exactly (case-sensitive)
- Check file permissions (should be readable)
- Clear theme cache
- This is normal behavior - it's dismissible
- Will reappear when settings are saved
Works with all modern browsers. The plugin itself has no JavaScript dependencies.
- Minimum WordPress: 5.0
- Minimum PHP: 7.4
- Tested up to: 6.7
- Multisite: Compatible
Author: Luis Martinez
Company: Less Rain GmbH
License: GPL v2 or later
- Added admin preview mode (view Coming Soon page while logged in)
- Added admin bar button for easy preview access
- Comprehensive documentation
- Improved code comments
- Security hardening with
hash_equals() - Enhanced admin interface with usage instructions
- Removed unnecessary Text Domain
- Core functionality and template system
For bug reports or feature requests, please open an issue on the GitHub Gist.
This plugin is licensed under the GPL v2 or later.
Copyright (C) 2024 Luis Martinez / Less Rain GmbH
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.