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

1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
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

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.