bp_document_extension( $attachment_id )
Return the extension of the attachment.
Description
Parameters
- $attachment_id
-
(Required)
Return
(mixed|string)
Source
File: bp-document/bp-document-functions.php
function bp_document_extension( $attachment_id ) {
$file_url = wp_get_attachment_url( $attachment_id );
$file_type = wp_check_filetype( $file_url );
$extension = trim( $file_type['ext'] );
if ( '' === $extension ) {
$file = pathinfo( $file_url );
$extension = ( isset( $file['extension'] ) ) ? $file['extension'] : '';
}
return $extension;
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.