I need a switch to Admin area which enables/disables crisis-mode. Redirect all traffic to certain page


Functionality needed:
There is natural disaster or terrorist attack etc. Admin login to site and enables "crisis mode". All traffic gets redirected to Crisis page.

I found this code from another answer, so I need the switch to admin area or admin menu which executes the code.

add_action( 'template_redirect', function() {
    if ( is_page( 813 ) ) {

    wp_redirect( esc_url_raw( home_url( 'index.php?page_id=183' ) ) );
} );
Antti Makela 2 months 0 Answers 9 views 0

Leave an answer