bp_blogs_remove_activity_meta_for_trashed_comments( int $post_id, array $comments = array() )

When a post is trashed, remove each comment’s associated activity meta.

Description Description

When a post is trashed and later untrashed, we currently don’t reinstate activity items for these comments since their activity entries are already deleted when initially trashed.

Since these activity entries are deleted, we need to remove the deleted activity comment IDs from each comment’s meta when a post is trashed.

Top ↑

Parameters Parameters


(int) (Required) The post ID.


(array) (Optional) Array of comment statuses. The key is comment ID, the value is the $comment->comment_approved value.

Default value: array()

Source Source

File: bp-blogs/bp-blogs-activity.php

function bp_blogs_remove_activity_meta_for_trashed_comments( $post_id = 0, $comments = array() ) {
	if ( ! empty( $comments ) ) {
		foreach ( array_keys( $comments ) as $comment_id ) {
			delete_comment_meta( $comment_id, 'bp_activity_comment_id' );

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.