WP_Comment::__construct() WordPress Method
The WP_Comment::__construct() method is used to setup a new Wordpress comment object. It can be used to create a new comment, or retrieve an existing comment from the database. This method accepts two parameters: the comment ID and the comment text.
WP_Comment::__construct( WP_Comment $comment ) #
Constructor.
Description
Populates properties with object vars.
Parameters
- $comment
(WP_Comment)(Required)Comment object.
Source
File: wp-includes/class-wp-comment.php
public function __construct( $comment ) {
foreach ( get_object_vars( $comment ) as $key => $value ) {
$this->$key = $value;
}
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |