wpDiscuz 7 API Documentation

  1. Home
  2. Docs
  3. wpDiscuz 7 API Documentation
  4. Filters
  5. wpdiscuz_live_update_new_comment_ids
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

wpdiscuz_live_update_new_comment_ids

This hook can be used to filter the comments appearing in the live update.

Changelog

Since 7.0.0 version

Parameters

1. $newCommentIds (type: array) – the array of the new comments’ IDs
2. $postId (type: int) – the parent post ID of the comments
3. $currentUser (type: WP_User object)- the object of the current user

Usage

add_filter("wpdiscuz_live_update_new_comment_ids", function ($newCommentIds, $postId, $currentUser) {
    if ($postId == 57) {
        $newCommentIds = array_slice($newCommentIds, 0, 5);
    }
    return $newCommentIds;
}, 10, 3);

Was this article helpful to you? Yes No