Renaming post to something else, breaks dashboard if edit_posts is false

It can not work for user roles that don’t see and don’t have access to the menu section. It just is not there – for them -, so you can’t address it, hence the errors you are getting. Just add a check:

if( current_user_can( 'edit_posts' ) ) { 
  //code 
}

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