bp_messages_add_meta( int $message_id, string|bool $meta_key, string|bool $meta_value, bool $unique = false )

Add a piece of message metadata.

Description

See also

  • add_metadata(): for full documentation excluding $meta_type variable.

Parameters

$message_id

(int) (Required) ID of the message to have meta deleted for.

$meta_key

(string|bool) (Required) Meta key to update.

$meta_value

(string|bool) (Required) Meta value to update.

$unique

(bool) (Optional) Whether the specified metadata key should be unique for the object. If true, and the object already has a value for the specified metadata key, no change will be made.

Default value: false

Return

(mixed)

Source

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

function bp_messages_add_meta( $message_id, $meta_key, $meta_value, $unique = false ) {
	add_filter( 'query', 'bp_filter_metaid_column_name' );
	$retval = add_metadata( 'message', $message_id, $meta_key, $meta_value, $unique );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	return $retval;
}

Changelog

Changelog
Version Description
BuddyPress 2.2.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.