Function Maintenance Mode

 In Admin, All

Function Maintenance Mode

If you need a quick and easy way of locking your site to non-admin users, just use this code snippet:


function ns_maintenace_mode() {

 if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
   die('YOUR MESSAGE');
 }

}
add_action('get_header', 'ns_maintenace_mode');

This will present a blank page with your chosen message.

Recommended Posts

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Start typing and press Enter to search

Let's work together

I'd love to work with you! Please fill out my project form to tell me more about your project/work. I reply to all enquiries within 48 hours.

Availability

  • November - Booked
  • December - Booked
  • January - Available

Rates

  • My day rate is £300.
  • I can provide a fixed price for your work.

EN - Header Enquiry Form

  • This form collects your name, email address and telephone number so that I can respond to the enquiry(ies) that you submit via this website. Please check my privacy policy for the full story on how I use, protect and manage your submitted data.