How to Set Default User Registration R...
Learn how to set the default user registration role in WooCommerce by adjusting line ...

WPCodeBox
311

Learn how to implement a maintenance mode in WordPress with a secret code to restrict access to your website.
add_action('get_header', function() {
if(!current_user_can('manage_options')){
// You can change the below secret code to whatever you want. This will let your customer see the website if the add to the link the following /?maint={YOUR SECRET CODE}
if($_GET['maint'] == 'SKASDJAS') {
setcookie('Maintenance', $_GET['maint'], time() + (86400 * 30), "/");
} elseif($_COOKIE['Maintenance'] == 'SKASDJAS') {
} else {
wp_die('<h1> Maintenance mode</h1><br> The site is in maintenance mode, <br>please check back later.',
'The site is in maintenance mode, please check back later.', array('response' => '503'));
}
}
});





