WordPress wp-content/languages目录语言文件上传后自动删除问题求助
Hey there, sorry to hear you're stuck with this annoying language file deletion issue on WordPress. Let's walk through practical fixes tailored to the two scenarios you described—files getting deleted right after upload, or vanishing an hour later:
Common Checks First
Verify directory and file permissions
This is the most frequent culprit. Thewp-content/languagesdirectory should have permissions set to755, and individual language files (like.moor.po) should be644. You can adjust these via FTP, SFTP, or your hosting control panel. Incorrect permissions can trigger security tools or server scripts to flag and delete the files.Disable security plugins temporarily
Tools like Wordfence, iThemes Security, or Sucuri often run real-time scans for "unauthorized" files. If you uploaded custom language files (not the official WordPress ones), these plugins might mistake them for malicious content. Disable the plugin, re-upload your language files, and see if they stick around. If they do, add thelanguagesdirectory or specific files to the plugin's whitelist.
Fixes for Instant Deletion
If files disappear right after upload, focus on real-time scanning systems:
- Check server-side security tools
Some hosts use ModSecurity or similar tools that block/delete files they deem suspicious. Reach out to your hosting support to temporarily disable ModSecurity for testing, or ask them to whitelist your language files. - Confirm file naming correctness
WordPress expects language files to follow a specific naming convention (e.g.,zh_CN.mofor Chinese Simplified). If your files have incorrect names (typos, wrong locale codes), WordPress might automatically delete them as invalid. Double-check the locale code matches what your site uses (you can find this in Settings → General).
Fixes for Deletion After One Hour
An hour delay points to scheduled cleanup tasks:
- Inspect WordPress cron jobs
Go to Tools → Site Health → Info → Cron Events to see if any plugin has added a scheduled task that cleans thelanguagesdirectory. If you spot one, disable the plugin responsible or adjust its settings to exclude language files. - Check hosting auto-cleanup rules
Many shared hosts run hourly cron scripts to delete "temporary" files. It's possible your host is targeting thelanguagesdirectory by mistake. Contact your hosting provider and ask them to excludewp-content/languagesfrom their automatic cleanup routines. - Disable automatic language updates
WordPress automatically updates official language packages by default. If you uploaded modified/custom language files, the auto-update might overwrite or delete them. Add this line to yourwp-config.phpfile to turn off auto-updates for languages:define('WP_AUTO_UPDATE_LANG', false);
Final Tip
After trying each fix, re-upload your language files and monitor them for the timeframe you noticed the deletion. Start with the simplest checks (permissions, security plugins) before moving to server-level settings.
内容的提问来源于stack exchange,提问作者muhammed alsmawi




