Restrict access to specific users

This should do it. Place it in your theme’s functions.php or a plugin.

function tst($a) {
  if (!current_user_can('edit_posts')) {
    wp_die('You are not allowed to view this page');
  }
}
add_filter('template_redirect','tst');

You can still get to the login page like normal by going to “/wp-login.php” or “/wp-admin”.

Alternately, you could use wp_safe_redirect or wp_redirect instead of wp_die to send people to a “Coming soon” page or something like that.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)