Apps Ballance Cash_2 Chat Checkout Click Code Cog_Wheels Compose_email Conference Contacts Earth Edit_File_1_ Email Email_2 File Folder_2 Gift Group Group_2 Help ID ID_2 Key Keys Laptop_Store Like_1_ Link Lock Log_Out Map Marketing Mobile_UI Navigation POS Partnership Profile Safe_2 Search_User Secure_Files Settings Share Shield Shield_2 Shopping_Cart Support_Male Trash Type_pin User_female User_male logo copy

Set maximum upload size for avatars and cover images

Iain Poulson avatar
Iain Poulson Last updated on March 6, 2021

It is recommended that you limit the size of the images that your members are able to upload onto your website. In this way you can prevent your users from wasting disk space on your server. 

In order to set a size limit, add the following line to your theme’s functions.php file, or to your wp-config.php file.

// Set the avatar image max size
define( 'WPUM_MAX_AVATAR_SIZE', 10240 );

// Set the cover image max size
define( 'WPUM_MAX_COVER_SIZE', 5242880 );

The above example will set the maximum file size for avatars to 10kb and cover images to5MB. The WPUM_MAX_AVATAR_SIZE and WPUM_MAX_COVER_SIZE constants only accept bytes as a value.

Sizes examples:

50kb = 51200

100kb = 102400

1mb = 1048576

You can use a website like this to help you calculate the any size you want

WP User Manager logo

Get Started with the Best WordPress Membership Plugin Today

Connect, Manage and Build your Membership Site

Need more help?

If you still didn't find an answer you can always contact us

Submit a ticket