bp_document_get_meta( int $document_id, string $meta_key = '', bool $single = true )

Get metadata for a given document item.

Description

Parameters

$document_id

(Required) ID of the document item whose metadata is being requested.

$meta_key

(Optional) If present, only the metadata matching that meta key will be returned. Otherwise, all metadata for the document item will be fetched.

Default value: ''

$single

(Optional) If true, return only the first value of the specified meta_key. This parameter has no effect if meta_key is not specified. Default: true.

Default value: true

Return

(mixed) The meta value(s) being requested.

Source

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

function bp_document_get_meta( $document_id = 0, $meta_key = '', $single = true ) {
	add_filter( 'query', 'bp_filter_metaid_column_name' );
	$retval = get_metadata( 'document', $document_id, $meta_key, $single );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	/**
	 * Filters the metadata for a specified document item.
	 *
	 * @since BuddyBoss 1.4.0
	 *
	 * @param mixed  $retval      The meta values for the document item.
	 * @param int    $document_id ID of the document item.
	 * @param string $meta_key    Meta key for the value being requested.
	 * @param bool   $single      Whether to return one matched meta key row or all.
	 */
	return apply_filters( 'bp_document_get_meta', $retval, $document_id, $meta_key, $single );
}

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.