How To Set WordPress Offline For Scheduled Maintenance

Here’s a snippet which allows you to notify your users when you set your WordPress offline for scheduled maintenance. We will use the wp_die functions. The best part about this code is it only shows the maintenance message for non-admin users, while the website admins can still access the /wp-admin/ path.

Just add the following snippet to your current theme’s functions.php file: