If you are getting this error whenever you are trying to install a WordPress plugin or theme, then here is a fix for that. And it worked for us.
Here you can see this error - “An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration.” - asap you try to install a new plugin or a theme.
If you want to fix this, I’ll share a simple solution for this:
1) Go to your Hosting’s cPanel.
2) Find “Health Checks and Monitoring” section.
3) Here you can find the list of ports blocked for your account. You can also find the reason for this. This is my friend’s website and I came to know that there was a malicious file inside the server.
I checked the file and found out it’s nowhere related to the WordPress theme or anything, so I just deleted it. I would suggest you to take a backup of the file(s) you’ll be deleting, it could be something important as well. That’s all.
4) After some time, I went to the WordPress dashboard and tried to install a new plugin. Tada! Now I can do this!
This ‘unexpected error’ issue is gone now. Now I can freely install any plugin or theme without any problem. This procedure fixed this issue, if you know any other methods or if you are still facing any error, do let us know!