1. Home
  2. Knowledge Base
  3. Customizations
  4. PHP Functions
  5. How to Change the Upload Limit of Profile and Cover Images

How to Change the Upload Limit of Profile and Cover Images

Introduction

By default, BuddyBoss limits the uploading of profile avatars and cover images to 5MB. You can increase this limit by adding a small custom function to your active theme. This guide explains how you can change the upload limit of profile and cover images.

Custom Workaround

  1. Go to Appearance > Theme Editor in your WordPress admin dashboard.
  2. Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme) and click Select.
  3. From the Theme Files list, open Theme Functions (functions.php).
  4. Add the following code just before the closing PHP tag ?>:
/* Adjust PROFILE COVER upload limit */

function bbp_cover_image_max_upload_file_size( $fileupload_maxk, $type ) {

    if ( 'cover_image' == $type ) {

        $fileupload_maxk = 10485760; // in bytes, 10MB

    }

    return $fileupload_maxk;

}

add_filter( 'bp_attachments_get_max_upload_file_size', 'bbp_cover_image_max_upload_file_size', 10, 2 );

/* Adjust PROFILE AVATAR upload limit */

add_filter( 'bp_core_avatar_original_max_filesize', function() {

    return 10485760; // in bytes, 10MB

} );

Note: The code above sets the upload limit to 10MB. You can adjust this value by changing 10485760 to any number in bytes.

  1. Click Update File to save the changes.

Note: Modifications are typically considered custom work, but we are making an exception in this case. Please review the BuddyBoss Support Policy.

Troubleshooting and FAQs

Q: I still get an error uploading large images.
A: Check your server’s PHP settings (upload_max_filesize and post_max_size) as they may also limit the file size. This code only modifies the BuddyBoss-specific limits.

Q: Can I set different limits for avatars and cover images?
A: Yes. Modify the numbers in each respective filter function to set different values for avatars and cover images.

Q: Will this affect other media uploads?
A: No. This change only applies to BuddyBoss profile avatars and cover images.

Q: Can I revert this change easily?
A: Yes. Remove or comment out the added code from functions.php and save the fil

Was this article helpful?

Related Articles

Subscribe to Our Newsletter

Stay In Touch

Subscribe to our Newsletter, and we’ll send you the latest news from BuddyBoss

  • This field is hidden when viewing the form
  • This field is for validation purposes and should be left unchanged.

To speak to our Agency consultant, fill in the form found at our Contact Page.

  • Get Started

    Enter your name and email address to get started with your project...

  • This field is for validation purposes and should be left unchanged.