Use WP CLI to reinstall everything when there's a possibility that the site is hacked and could include some malicious code. Also be sure that you download/deploy fresh copies of plugins and themes that aren't hosted in the WordPress repositories
Use --skip-content
to not download default themes/plugins.
Dont do this if wp installation is any way customised, bedrock etc
wp core download --force --skip-content
Use --skip-plugins --skip-themes
to skip plugins and themes to minimize errors and prevent running the possible malicious code
wp plugin install $(wp plugin list --field=name --skip-plugins --skip-themes) --force --skip-plugins --skip-themes
Use --skip-plugins --skip-themes
to skip plugins and themes to minimize errors and prevent running the possible malicious code
wp theme install $(wp theme list --field=name --skip-plugins --skip-themes) --force --skip-plugins --skip-themes