Like many other plugins, Complianz stores several files (e.g. CSS files and Maxmind Database) in the publicly available /uploads/ folder. However, some Complianz users with a customised WordPress configuration might want to change the location of these files. For these situations we have implemented two filters:
cmplz_upload_url and cmplz_upload_dir
In a standard WordPress setup, this will return a default string:
{path or URL}/wp-content/uploads/complianz/
Please find below an example snippet to change the upload directory to “/new-folder/”.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change the Complianz upload folder to /new-folder/ | |
*/ | |
add_filter('cmplz_upload_dir', 'complianz_upload_dir_filter' ); | |
add_filter('cmplz_upload_url', 'complianz_upload_url_filter' ); | |
function complianz_upload_dir_filter() { | |
$uploads = wp_upload_dir(); | |
$upload_dir = $uploads['basedir']; | |
return $upload_dir . '/new-folder/'; | |
} | |
function complianz_upload_url_filter() { | |
$uploads = wp_upload_dir(); | |
$upload_url = $uploads['baseurl']; | |
return $upload_url . '/new-folder/'; | |
} |