Add using crontab -e
Replace /var/www/<domain>
with the actual path to your WordPress directory
# All files in our WordPress directory should have 644 permissions rw-r--r--
0 0 * * 0 find /var/www/<domain> -type f ! -perm 644 -exec chmod 644 {} \; >/dev/null 2>&1
Some plugins or themes can require 755 in /wp-content/* They will generally notify you about this.
# All subdirectories in our WordPress directory should have 750 permissions rw-rrwxr-xr-xr--
0 0 * * 0 find /var/www/<domain> -type d ! -perm 750 -exec chmod 750 {} \; >/dev/null 2>&1
# WP config file should be hardened to 440 permissions -r--r-----
# It should be 440 or 400 to prevent other users on the server from reading it.
0 0 * * * chmod -R 440 /var/www/<domain>/public_html/wp-config.php >/dev/null 2>&1
# 444 for the index.php is for higher security -r--r--r--
0 0 * * * chmod -R 444 /var/www/<domain>/public_html/index.php >/dev/null 2>&1