Call to a member function get_error_messages() on null [closed]

The answer is right there in your error. Your first if checks that $reg_errors is definitely an instance of WP_Error, but your elseif doesn’t. You need:

elseif ( is_wp_error( $reg_errors ) && count( $reg_errors->get_error_messages() ) < 1 )

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