Plugin Planet

Premium WordPress Plugins

By default, USP Pro integrates with the WordPress Media Library. This means that files submitted via USP form are uploaded to the default directory, /wp-content/uploads/ or something like /wp-content/uploads/2014/01/ if you have selected the WP option to “Organize my uploads into month- and year-based folders”.

With USP Pro, you can define a custom directory located within the /uploads/ directory. Simply add this line to the wp-config.php file:

define('USP_UPLOAD_DIR', '/custom/');

Here we are defining a constant with the name of our custom uploads directory. Change “custom” to whatever you prefer. Also important is to make sure that the directory /uploads/custom/ exists on your server with suitable permissions. Currently this technique only works when the option “Organize my uploads into month- and year-based folders” is not selected.

Custom uploads directory via plugin

If you would rather not add a line to your wp-config.php file, here is the same method implemented via must-use plugin. Just create a blank PHP file named mu-usp.php (or whatever you prefer) and add the following slab of code:

<?php
/*
	Plugin Name: USP Pro - Custom Uploads Directory
	Description: Define and enable custom upload directory and permissions for USP Pro.

	To enable custom uploads directory for USP Pro:
		1. Create a new directory in the /uploads/ directory
		2. Give that directory proper permissions (ask your host)
		3. Replace the "usp" in the path below with the name of your new directory
		4. Done! USP Pro will auto-detect the new directory and use it for all uploaded files.

	Note: Subdirectory (e.g., "/usp/sub/") is allowed if given the proper permissions!
*/
define('USP_UPLOAD_DIR', '/usp/'); // default custom path = "/usp/"

Then upload the file to a directory named mu-plugins located in the wp-content directory. So the final must-use plugin will reside at:

/wp-content/mu-plugins/mu-usp.php

After uploading the plugin, test well before going live with the functionality.