WordPress: Maintenance mode without plugin

If you need to keep your website down while you perform an upgrade or solve some problem, there are plenty of WordPress plugins that allow you to activate the maintenance mode and show a “Down for Maintenance” message to visitors. However, you can do this even without adding to the clutter of plugins on your WordPress site.