bp_document_folder_delete_meta( int $folder_id, string $meta_key = '', string $meta_value = '', bool $delete_all = false )

Delete a meta entry from the DB for an document folder feed item.




(int) (Required) ID of the document folder item whose metadata is being deleted.


(string) (Optional) The key of the metadata being deleted. If omitted, all metadata associated with the document item will be deleted.

Default value: ''


(string) (Optional) If present, the metadata will only be deleted if the meta_value matches this parameter.

Default value: ''


(bool) (Optional) If true, delete matching metadata entries for all objects, ignoring the specified object_id. Otherwise, only delete matching metadata entries for the specified document folder item. Default: false.

Default value: false


(bool) True on success, false on failure.


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

function bp_document_folder_delete_meta( $folder_id, $meta_key = '', $meta_value = '', $delete_all = false ) {

	// Legacy - if no meta_key is passed, delete all for the item.
	if ( empty( $meta_key ) ) {
		$all_meta = bp_document_folder_get_meta( $folder_id );
		$keys     = ! empty( $all_meta ) ? array_keys( $all_meta ) : array();

		// With no meta_key, ignore $delete_all.
		$delete_all = false;
	} else {
		$keys = array( $meta_key );

	$retval = true;

	add_filter( 'query', 'bp_filter_metaid_column_name' );
	foreach ( $keys as $key ) {
		$retval = delete_metadata( 'folder', $folder_id, $key, $meta_value, $delete_all );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	return $retval;


Version Description
BuddyBoss 1.4.0 Introduced.


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.