Last active
August 29, 2015 14:16
-
-
Save jtcote/4145595d1ef73f2840fe to your computer and use it in GitHub Desktop.
WP maintenance page redirect function
This file contains 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
/***** MAINTENANCE *****/ | |
//* Redirect for temp landing page | |
add_action( 'template_redirect', 'gum_redirect_maintenance_page' ); | |
function gum_redirect_maintenance_page() { | |
$redirect = FALSE; | |
$page = home_url( '/maintenance/' ); //slug for wp page | |
if ( $redirect && !is_user_logged_in() && trim( $_SERVER['REQUEST_URI'], '/' ) != 'maintenance' && $_SERVER['REQUEST_URI'] != '/wp-admin/' ) : | |
wp_redirect( $page ); | |
exit; | |
endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment