Created
August 31, 2017 11:36
-
-
Save strangerstudios/9707b8ada410a4a70df40a612799f676 to your computer and use it in GitHub Desktop.
Redirect users to a maintenance.html file unless they are coming from your IP address. WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Lock site down to just our IP | |
Create a file /maintenance.html that explains that maintenance mode is on. | |
Update your IP address in the line below. | |
Add this code to your active theme's functions.php or a custom plugin. | |
*/ | |
function mainenance_mode_on() { | |
if($_SERVER['REMOTE_ADDR'] == 'YOURIPADDRESSHERE') //find your IP and edit here | |
return; | |
wp_redirect('/maintenance.html'); | |
exit; | |
} | |
add_action('init', 'mainenance_mode_on'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment