server/content/plugins/redirect-home.php
Ryan McCue edb5bfcf60
Add the home redirect plugin (#7)
Signed-off-by: Ryan McCue <me@ryanmccue.info>
2025-07-21 16:39:47 +01:00

21 lines
451 B
PHP

<?php
/**
* Plugin Name: FAIR Server - Redirect to GitHub
*/
add_action( 'template_redirect', function() {
// Logged in users can see the site.
if ( is_user_logged_in() ) {
return;
}
// Also, allow access to login and admin, even for non-logged-in users.
// (Admin allows the redirect to the login page.)
if ( is_admin() || is_login() ) {
return;
}
// Redirect to GitHub.
wp_redirect( 'https://github.com/fairpm', 302 );
exit;
} );