Hide page for user logged and redirect for profile? [duplicate]

Not tested but should work

add_action('wp', function() {
  $url = home_url('my-profile/'); // profile url here
  if(is_user_logged_in()){
    if(is_front_page() || is_home()){
      wp_redirect($url);
      exit;
    }
  }
});

Edit: I hooked into wp so the functions in the conditional will work. Add the above snippet of code to your child theme’s functions file, after you edit the $url on line:2

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