bp_get_attachment_media_id( integer $attachment_id )

Get media id for the attachment.

Description

Parameters

$attachment_id

(Required)

Return

(array|bool)

Source

File: bp-media/bp-media-functions.php

function bp_get_attachment_media_id( $attachment_id = 0 ) {
	global $bp, $wpdb;

	if ( ! $attachment_id ) {
		return false;
	}

	$attachment_media_id = (int) $wpdb->get_var( "SELECT DISTINCT m.id FROM {$bp->media->table_name} m WHERE m.attachment_id = {$attachment_id}" );

	return $attachment_media_id;
}

Changelog

Changelog
Version Description
BuddyBoss 1.3.5 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.