Lock or unlock your WordPress from command line. This script will make it immutable so no modification on your files will work except in uploads directory. When you want to install a plugin or theme etc, just unlock and lock again
wget https://cdn.jsdelivr.net/gh/iqltechnologies/wordpress-lock-unlock/lu.sh- make it executable
chmod +x hc.sh - run it
./hc.sh lock(or unlock)
Tariq Abdullah 2024