Created
November 16, 2022 15:38
-
-
Save jenhuls/f514a23134aa337d5f86d584ad1b3a8a to your computer and use it in GitHub Desktop.
[Maintenance Redirect Function] #WordPress
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
function maintenance_redirect(){ | |
if( !is_user_logged_in() ){ | |
wp_redirect( site_url( 'maintenance.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