Recently I have noticed that one of my client’s websites is taking up more disk space every week. It was growing for maybe 1 GB per week or so. It seemed really suspicious to me.
It is a big heavy niche community website build with a combo of BuddyBoss + WooCommerce + LearnDash plugins.
Part of this community is sharing a lot of photos of what they are cooking. So, I assumed that this could be WordPress media at wp-content/uploads that is taking up all this space.
I went into uploads folder and checked the size of each subfolder.
What a big surprise for me was to see that it is not the “2022” or “2021” WordPress media folder taking tens of gigabytes of space. It is a weird folder called “bb-platform-previews”.
Imagine this – whole website was taking about 200 GB, and the owner was thinking it’s just media that members are uploading every day. However this “bb-platform-previews” folder was solely taking 150 GB 😂😂
I went to check the settings and found out that we had a feature called “Symbolic Links” enabled under BuddyBoss > Settings > Media > Media Security & Performance.
Basically, it is a feature that turns your default WordPress uploads urls to some encoded letters and numbers urls.
For example, the encoded symbolic link to an image looks like this:
I took some time to research the source code of BuddyBoss Platform plugin and found out that symlinks feature was not a simple redirect script to the actual image file, but it also generates separate files (like a desktop shortcut) linked to the image files. It generates extra files inside “bb-platform-previews” folder!
I am not sure what exactly went wrong with this feature, but it looks like it was spawning new “link” files on every page load. Or there should have been some scheduled task that removes the old “link” files and it was not working. That’s how the little secondary folder became a 150 GB monster.
Since this project does not have any secret materials uploaded by the members, they don’t care if the url is encoded with symlink or not.
Finally, we decided to disable the symlink generation for media completely and also revert the urls for media previews back to default WordPress urls.
Note: there is also symlink generation for document previews and video previews, which we do not address in the code below.
The code that disables BuddyBoss symbolic link generation for media and reverts preview urls back to default:
/* STOP MEDIA SYMLINK GENERATION */
add_filter( 'bb_media_do_symlink', '__return_false' );
/* RECOVER DEFAULT ATTACHMENT URLS FOR MEDIA PREVIEWS */
function bf_get_preview_image_url( $url, $media_id, $attachment_id, $size )
$url = wp_get_attachment_image_url( $attachment_id, $size );
if( empty( $url ) ) $url = '';
add_filter( 'bp_media_get_preview_image_url', 'bf_get_preview_image_url', 999, 4 );
If you have any questions, let me know in the comments below.