wpDiscuz 7 API Documentation

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


This hook can be used for doing some action before getting comments.


since 7.0.0 version


1. $commentsArgs (type: array) – the merged array that includes values of the default arguments and arguments that are passed to the function. The array should be passed to get_comments() function.
2. $currentUser (type: WP_User object) – the user object that is logged in at the current time
3. $args (type: array) – the arguments that are passed to the function


add_action("wpdiscuz_before_getcomments", function ($commentsArgs, $currentUser, $args) {
    if (!empty($currentUser->ID)) {
        $customValues = $this->init_custom_actions();
}, 10, 3);

Was this article helpful to you? Yes No 1