bp_messages_clear_cache_on_message_delete( int|array $thread_ids, int $user_id )

Clear message cache after a message thread is deleted.

Parameters Parameters


(int|array) (Required) If single thread, the thread ID. Otherwise, an array of thread IDs.


(int) (Required) ID of the user that the threads were deleted for.

Source Source

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

function bp_messages_clear_cache_on_message_delete( $thread_ids, $user_id ) {
	// Delete thread and thread recipient cache.
	foreach( (array) $thread_ids as $thread_id ) {
		wp_cache_delete( $thread_id, 'bp_messages_threads' );
		wp_cache_delete( "thread_recipients_{$thread_id}", 'bp_messages' );

	// Delete unread count for logged-in user.
	wp_cache_delete( $user_id, 'bp_messages_unread_count' );

Top ↑

Changelog Changelog

Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.