Last active
April 26, 2016 18:00
-
-
Save mspalex/343e7f4206f44dd2669d8e113a5bbebc to your computer and use it in GitHub Desktop.
A quick way to redirect logged off users of wordpress, when in site development. used it to redirect to a static webpage, on the same server but only a landing page for informing that is in construction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* send logged off users to maintenance - comment to disable*/ | |
/* sometimes reg users sessions expire, need to comment temporarily*/ | |
function maintenance_redirect(){ | |
if( !is_user_logged_in() ){ | |
wp_redirect( site_url( 'em-construcao.html' ), 302 ); | |
exit(); | |
} | |
} | |
add_action( 'init', 'maintenance_redirect' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment