Advertisement
drkskwlkr

Maintenance Mode

Jul 26th, 2023 (edited)
1,291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | Source Code | 0 0
  1. <?php
  2.  
  3. add_action( 'template_redirect', function () {
  4.     $secret_pass = 'go';
  5.     $maintenance_url = '/under-construction/';
  6.     $protocol = 'https://';
  7.     $user_is_admin = current_user_can( 'manage_options' );
  8.  
  9.     if ($user_is_admin) return;
  10.  
  11.     if ( ($_GET ['access'] ?? "") === $secret_pass ) return;
  12.  
  13.     $path = $_SERVER[ 'REQUEST_URI' ];
  14.  
  15.     if ( $path !== $maintenance_url ) {
  16.         exit ( wp_redirect( home_url( $maintenance_url), 307 )) ;
  17.     }
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement