If your WordPress website gets hacked, take immediate action by changing all passwords, restoring a clean backup of your website, scanning for malware, updating all plugins and themes, and consulting with a security professional if needed. Implement additional security measures to prevent future attacks.