indikatordesign

Coming Soon Snippet

Mar 5th, 2017
106
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // add a page called Coming Soon and adjust it to your needs
  2. // your url should look like this: domain.com/coming-soon/
  3. // then simply paste this into you themes functions.php
  4.  
  5. add_action( 'init', function()
  6. {
  7.  
  8.     if( ! is_user_logged_in() )
  9.     {
  10.  
  11.         if ( isset( $_SERVER['REQUEST_URI'] )
  12.             && ( '/coming-soon/' == $_SERVER['REQUEST_URI']
  13.                 || '/wp-admin/' == $_SERVER['REQUEST_URI']
  14.                 || false !== strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) ) ) return;
  15.  
  16.         wp_redirect( '/coming-soon/' );
  17.  
  18.         exit;
  19.  
  20.     }
  21.  
  22. });
RAW Paste Data