Using the WordPress WP_Filesystem API to Read and Write Files Safely
The WP_Filesystem API: write files the way WordPress does When WordPress updates a plugin, it does not always write files with PHP directly. On some servers PHP runs as a user that may not change the WordPress files, and WordPress asks for FTP or SSH credentials instead. The WP_Filesystem API is the layer that hides…