Created
April 2, 2023 06:13
-
-
Save imath/13a6b03a6ec9c362818d1045c64bba2d to your computer and use it in GitHub Desktop.
Filter to override the BP Attachments private directory
This file contains 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 | |
/** | |
* BP Attachments overrides. | |
*/ | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
/** | |
* Changes the Private directory path in favor of: | |
* `/wp-content/uploads/buddypress/private`. | |
* | |
* NB: you need to take care of privacy by yourself in this case. | |
* | |
* @return string Path to the private directory. | |
*/ | |
function return_bp_attachments_private_dir_override() { | |
return trailingslashit( bp_attachments_uploads_dir_get( 'basedir' ) ) . 'private'; | |
} | |
add_filter( 'bp_attachments_pre_get_private_root_dir', 'return_bp_attachments_private_dir_override' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment