get_comment()
Retrieves comment data given a comment ID or comment object.
If an object is passed then the comment data will be cached and then returned after being passed through a filter. If the comment is empty, then the global comment variable will be used, if it is set.
Uses: WP_Comment()
Used By: get_comment_text(), get_comment_author()
1 time — 0.000436 sec (fast) | 50000 times — 0.38 sec (very fast) | PHP 7.1.2RC1, WP 4.7.2
Hooks from the function
Return
WP_Comment|Array|null
. Depends on $output value.
Usage
get_comment( $comment, $output );
- $comment(WP_Comment|string|int)
- Comment to retrieve.
Default: null - $output(string)
- The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a WP_Comment object, an associative array, or a numeric array, respectively.
Default: OBJECT
Notes
- Global. WP_Comment. $comment Global comment object.
Changelog
Since 2.0.0 | Introduced. |