I have a snippet to redirect all users to a maintenance page. How do I exclude users with admin role?
I have a snippet that redirects all users to a maintenance page. How can I tweak it to All users except admin users?
?php
add_action( 'template_redirect', function() {
if ( is_page( 4848 ) ) {
return;
}
wp_redirect( esc_url_raw( home_url( 'maintenance/' ) ) );
//wp_redirect( esc_url_raw( home_url( 'index.php?page_id=4848' ) ) );
exit;
} );
Topic php maintenance Wordpress
Category Web