Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Created June 22, 2021 13:55
Show Gist options
  • Select an option

  • Save wbcomdev/4048fbe3487da4f642959e00fdea5f3c to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/4048fbe3487da4f642959e00fdea5f3c to your computer and use it in GitHub Desktop.
<?php
/**
* Sets the file types for upload bp profile avatar.
*
* @param array $exts extensions.
* @param string $type attachment type.
*
* @return array
*/
function wbcom_set_file_type_for_bp_profile_avatar( $exts, $type ) {
if ( 'avatar' !== $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_avatar', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment