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.


Top ↑

Parameters

$comment

(WP_Comment)(Required)Comment object.


Top ↑

Source

File: wp-includes/class-wp-comment.php

	public function __construct( $comment ) {
		foreach ( get_object_vars( $comment ) as $key => $value ) {
			$this->$key = $value;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.