36 lines
635 B
PHP
36 lines
635 B
PHP
<?php
|
|
/**
|
|
* @package ogre-suspension
|
|
* @author cleverogre
|
|
* @version 1.0.0
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
namespace Ogre\Suspension;
|
|
|
|
use Ogre\Singleton;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
final class Redirect {
|
|
use Singleton;
|
|
|
|
protected function __construct() {
|
|
add_action('wp', [$this, 'maybe_redirect'], 1);
|
|
add_action('login_init', [__CLASS__, 'do_redirect'], 1);
|
|
}
|
|
|
|
public function maybe_redirect():void {
|
|
if (is_front_page()) return;
|
|
self::do_redirect();
|
|
}
|
|
|
|
public static function do_redirect():void {
|
|
wp_redirect(get_site_url());
|
|
exit;
|
|
}
|
|
|
|
}
|
|
|
|
Redirect::instance();
|