Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Last active June 22, 2021 13:58
Show Gist options
  • Select an option

  • Save wbcomdev/0058013514fbcfcd63b81ce659abc1f2 to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/0058013514fbcfcd63b81ce659abc1f2 to your computer and use it in GitHub Desktop.
<?php
/**
* Sets the file types for upload BuddyPress User and Group Cover Image.
*
* @param array $exts extensions.
* @param string $type attachment type.
*
* @return array
*/
function wbcom_set_file_type_for_bp_profile_cover_image( $exts, $type ) {
if ( 'cover_image' !== $type ) {
return $exts;
}
$exts = array( 'jpeg', 'png' );// Add your own file types.
return $exts;
}
add_filter( 'bp_attachments_get_allowed_types', 'wbcom_set_file_type_for_bp_profile_cover_image', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment