If you feel that your worpress was hacked or infected by malware, there are few basic steps you should follow:
1.- execute an online malware scanner:
2.- Check integrity of core php files and restore original files if possible (if not, reinstall same version of wordpress):
access your server using SSH and perform the following command:
find ./ -type f -mtime -15 (15 is 15days, put the amount of days that fit better your case)
3.- Manually remove changes in your pages.
with online malware scanners you can find which pages are affected.
You may also find some wordpress pluggins that may help you clean SPAM injected links in your pages.
4.- it’s always recommended to upgrade wordpress to latest version, but for some compatibility issues is not always a possible option.
If you found a good way to solve this wordpress problem, comment with your solution and hints.