InfiniteWP logo

Customizing the InfinteWP Backup Storage Directory

InfiniteWP (IWP) is a centralized management solution for WordPress sites. For someone who manages a large number of WordPress sites, it’s a great way to manage backups, roll out emergency updates, and more, all from one place.

All my ongoing clients are hosted on their own VPS at Digital Ocean. This allows me to scale and manage resources on a client-to-client basis. Someone hits their storage limit? It’s easy enough to mount a cheap storage volume to their droplet and get them back in action.

Local Backups

While the backups I take with IWP are ultimately stored offsite on S3, the process takes place on the server the site is on, which inflates your storage during the process. For one of my clients, this meant going above their storage limit. I quickly mounted a volume and moved the uploads directory onto that volume, where they would be stored going forward.

However, when IWP takes a backup, it doesn’t keep it in the uploads directory while it’s being created. Instead, it uses its own directory within wp-content.  This means that while the uploads were being stored on the new volume, these backups were being stored on the original VPS. This was fine at the moment, but would eventually break as I continued scaling the volume beyond the original VPS storage limit.

Customize the IWP Backup Directory

Fortunately, you can quickly change the directory IWP uses to store backups. All it takes is customization of a PHP constant. For me, it was ideal to put it within the `uploads` directory so it would be stored on the new volume.

You can define this within the wp-config.php file, but be sure to add it after WP_CONTENT_DIR is defined. If you have a proprietary plugin you load to all your sites and you want to configure them all this way, you could define it there as well. Since this uses a PHP constant, you shouldn’t have to define it within an action or filter. Within the plugin’s main file should be fine.

	define('IWP_BACKUP_DIR', WP_CONTENT_DIR . '/uploads/infinitewp/backups');

And you’re done.


Leave a Reply

Your email address will not be published. Required fields are marked *