Method 1: Using a WordPress Plugin #
The easiest way to enable Maintenance Mode is by using a plugin like WP Maintenance Mode or Coming Soon Page & Maintenance Mode by SeedProd.
Step 1: Install a Maintenance Mode Plugin #
- Log in to your WordPress dashboard.
- Go to Plugins > Add New.
- Search for WP Maintenance Mode or SeedProd.
- Click Install Now, then Activate.
Step 2: Configure Maintenance Mode Settings #
- Go to Settings > WP Maintenance Mode.
- Enable Maintenance Mode by toggling the switch to ON.
- Customize the Title, Message, and Background to suit your site’s branding.
Step 3: Preview and Save Changes #
- Click Save Settings.
- Open your website in an Incognito window or a different browser to see the Maintenance Mode page.
Tip: #
- You can whitelist your IP address in the settings to view the site normally while visitors see the maintenance message.
Method 2: Manually Enable Maintenance Mode via functions.php #
If you prefer not to use a plugin, you can add a simple code snippet to your functions.php file.
Step 1: Access functions.php #
- Log in to your hosting account and open the File Manager (or use an FTP client like FileZilla).
- Navigate to wp-content/themes/your-theme/.
- Open the functions.php file for editing.
Step 2: Add the Maintenance Mode Code #
Copy and paste the following code snippet into the functions.php file:
phpCopy codefunction wp_maintenance_mode() {
if (!current_user_can('edit_themes') || !is_user_logged_in()) {
wp_die('<h1>Under Maintenance</h1><p>We are currently performing scheduled maintenance. Please check back later.</p>');
}
}
add_action('get_header', 'wp_maintenance_mode');
Step 3: Save and Test #
- Save the changes and close the file.
- Open your website in an Incognito window to see the maintenance message.
Tip: #
- Only users who are logged in can bypass the Maintenance Mode page.
Method 3: Using .htaccess for Maintenance Mode #
If you have access to the .htaccess file, you can use it to enable Maintenance Mode.
Step 1: Access the .htaccess File #
- Log in to your hosting account and go to the File Manager.
- Open the public_html directory and find the .htaccess file.
- Edit the .htaccess file.
Step 2: Add the Maintenance Mode Code #
Insert the following code at the top of the .htaccess file:
apacheCopy codeRewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteRule ^(.*)$ /maintenance.html [R=302,L]
Step 3: Create a Maintenance Page #
- Create a simple maintenance.html file with your maintenance message.
- Upload this file to the public_html directory.
Tip: #
- Replace 123.456.789.000 with your IP address to allow yourself access while others see the maintenance page.
Method 4: Using WP-CLI (Advanced) #
If you have SSH access and prefer using command-line tools, you can enable Maintenance Mode using WP-CLI.
Step 1: Connect via SSH #
- Open your terminal or SSH client (e.g., PuTTY).
- Connect to your server using SSH credentials.
Step 2: Enable Maintenance Mode #
Run the following command:
bashCopy codewp maintenance-mode activate
Step 3: Disable Maintenance Mode #
To turn off Maintenance Mode, use:
bashCopy codewp maintenance-mode deactivate
Step 5: Test Your Site and Exit Maintenance Mode #
- Check your website to ensure the Maintenance Mode page is displaying correctly.
- Once you have completed your updates or changes, disable Maintenance Mode:
- Plugin Method: Toggle the switch to OFF in the plugin settings.
- Manual Method: Remove the code snippet from functions.php or .htaccess.
- WP-CLI Method: Run
wp maintenance-mode deactivate
.
Additional Tips: #
- Use a Custom Message: Personalize the Maintenance Mode page with your brand’s logo, a message, and an estimated time for when the site will be back online.
- Enable a Countdown Timer: Some plugins allow you to add a countdown timer, which can help inform visitors of the expected downtime.
- Backup Your Site: Before making major updates or changes, always create a backup of your site.