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 www.example.com/wp-admin/ login path while this nippet is active.

Instructions
Add this to your functions.php file.

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

Relevant Links
http://codex.wordpress.org/Function_Reference/wp_die

Comments

One Reply to “Set WordPress site offline for maintenance”

Leave a Reply

Your email address will not be published. Required fields are marked *

Siteground Web Hosting

Snippet Info

Tested with Wordpress v. NA
Review Status: Needs Review

Set WordPress site offline for maintenance
4.3 (86.67%) 6 votes
Please report broken snippets.
Report Broken Snippet