When you need to put your wordpress blog on hold while performing some maintenance.


/ Published in: PHP

Just paste the following snippet into your functions.php file and save it.


Copy this code and paste it in your HTML
  1. function cwc_maintenance_mode() {
  2. if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
  3. wp_die('Maintenance, please come back soon.');
  4. }
  5. }
  6. add_action('get_header', 'cwc_maintenance_mode');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.