Set WordPress site offline for maintenance

This snippet will easy let you set your wordpress site offline by using the wp_die. This is a handy and easy way for you to kill wordpress functions (sets your site offline – but still displays HTML for your visitors) while you perform website maintenance or other website related services.

*note – in this example we have set the if ( !current_user_can conditions ex. to limit the wp_die functions to be executed to non admins only. You can also still access the login path while this nippet is active.

Add this to your functions.php file.

*Replace any relevant info you wish to be displayed for your visitors

Relevant Links