• How To?
  • Tips ‘n Tricks
  • WordPress
  • Snippets
  • Software
    • Browsers
    • Downloads
  • Web
  • Tools
    • Character Counter
    • chmod Calculator
    • Entities Encoder
    • Live HTML Editor
    • My IP
  • Contact
Twitter Facebook Google+ RSS
You are here: SumTips » Snippets » WordPress Snippets » Display Simple Maintenance Mode Message to Non-Admins

Display Simple Maintenance Mode Message to Non-Admins

Posted on November 13, 2011 by Renji | Short URL: http://sumtips.com/?p=5922

Here’s a snippet to display a simple maintenance mode message to all non-admin visitors of your WordPress blog, while you carry on your tasks in the back-end.

function wp_maintenance_mode() {
	if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ) {
	wp_die('Site is undergoing maintenance at the moment, please come back after some time.');
	}
}
add_action('get_header', 'wp_maintenance_mode');

Paste and save the code in your default theme’s functions.php. After completing your tasks, simply delete the code.


Tweet

Related posts:

  • Create New User in WordPress Using functions.php
  • Get Unread Gmail Message Count in Favicon
  • Always Start Firefox In Private Mode
  • Display Your Latest Google+ Update on WordPress
  • Set Different Favicons for Frontend, Backend and Login Page on WordPress
Categories: WordPress Snippets
Delete Akismet and Spam Comments Metadata
Search and Delete Unused Post Tags in WordPress

  • Get Updates via Email

  • Recent Posts

    • CMS2CMS: Migrate Site from Drupal or Joomla to WordPress
    • WordPress: Add Preview Button in Distraction Free Writing
    • How to Activate or Deactivate Individual Jetpack Modules
    • Windows 8: Auto Update Defender with Windows Update Disabled
    • Automatically Start and Close Programs at Specific Time
    • How to Copy Code from Notepad++ with Syntax Highlighting
  • Random Posts

    • Google Plus Cover Creator, Cover Template Guides & Dimensions
    • Add Create Folder List, Copy File/Folder Name to Explore Context Menu
    • Google Docs Gets Drag and Drop Upload Feature
    • Implement Google Prettify Code Highlighting in WordPress the Manual Way
    • Get Google Analytics on Your Desktop with Polaris
    • Find All Encrypted and Disguised TrueCrypt Containers on Windows
  • Categories

    • Blogging
    • Games
    • Google
    • How To?
    • Linux
    • Microsoft
      • Windows
    • Miscellaneous
    • Phone
    • Snippets
      • AutoHotkey Snippets
      • CSS Snippets
      • htaccess Snippets
      • JavaScript Snippets
      • PowerShell Snippets
      • WordPress Snippets
    • Social
    • Software
      • Browsers
    • Tips 'n Tricks
    • Wallpapers
    • Web
© SumTips. Contact | Sitemap | Privacy Policy