bp_friends_clear_bp_friends_friendships_cache_remove( int $friendship_id, BP_Friends_Friendship $friendship )

Clear friendship caches on friendship changes.

Description

Parameters

$friendship_id

(Required) The friendship ID.

$friendship

(Required) Friendship object.

Source

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

73
74
75
76
77
78
79
80
81
82
83
function bp_friends_clear_bp_friends_friendships_cache_remove( $friendship_id, BP_Friends_Friendship $friendship ) {
    // Clear friendship ID cache for each user.
    wp_cache_delete( $friendship->initiator_user_id, 'bp_friends_friendships_for_user' );
    wp_cache_delete( $friendship->friend_user_id,    'bp_friends_friendships_for_user' );
 
    // Clear the friendship object cache.
    wp_cache_delete( $friendship_id, 'bp_friends_friendships' );
 
    // Clear incremented cache.
    bp_friends_delete_cached_friendships_on_friendship_save( $friendship );
}

Changelog

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