You have to fnd two things a) the infected file(s), and (b) the orignal vulnerability that allowed the hack to take place.
Read: https://www.ads-software.com/support/article/faq-my-site-was-hacked/
The standard process is:
1) Put your site in maintenance mode to prevent any loss to SEO
2) Take a full site and database backup
3) Replace all passwords and salt keys
4) Replace all WordPress core files (except wp-config.php
and /wp-content/
directory) with fresh version downloaded from WordPres.org
5) Replace all plugin and theme directories with fresh version downloaded from WordPres.org
6) Audit used plugins/themes – are these maintained and regularly updated?
7) Examine all the remaining files/directories carefully – check timestamps for recent changes, strange or obfuscated code, odd filenames
8) Ask host if they have any input e.g. other hacked sites on same server, anti-malware scan results for your site
9) Remove any unauthorised users with admin rights
When you beleive you are done, read and implement the suggestions in: https://www.ads-software.com/support/article/hardening-wordpress/
If you can’t resolve it, seek extenal help.
Good luck!