Skip to content

Instantly share code, notes, and snippets.

@JoeSz
Forked from WordPress-Handbuch/listing-18-2.php
Created September 4, 2019 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeSz/fbdfbc3837f7044bd9ea5252aa64b8ba to your computer and use it in GitHub Desktop.
Save JoeSz/fbdfbc3837f7044bd9ea5252aa64b8ba to your computer and use it in GitHub Desktop.
WordPress hook to activate a basic maintenance mode showing a message for everybody but the administrator
function wh_maintenance_mode() {
if ( !is_user_logged_in() || !current_user_can('administrator') ) {
wp_die( 'Dritte Variante einer Wartungsseite', 'Wartung!', array( 'response' => '503'));
}
}
add_action( 'get_header', 'wh_maintenance_mode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment