Maintenance mode in WordPress

<?php function maintenace_mode() { if ( !current_user_can( 'administrator' ) ) { wp_die('Maintenance.'); } } add_action('get_header', 'maintenace_mode'); ?>
If you are making some live changes(like updating source code and design) on your blog, you might want to enter a maintenance mode to keep the users from disturbing you.

Or, you can use this plugin - https://wordpress.org/plugins/wp-maintenance-mode/

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.