Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Latest commit

 

History

History
208 lines (103 loc) · 3.59 KB

File metadata and controls

208 lines (103 loc) · 3.59 KB

Comment

Class that represent a wordpress comment

Example

	$comment = new \WPS\Comment($wp_comment);

Author : Olivier Bossel olivier.bossel@gmail.com https://olivierbossel.com

Constructor

Construct the object using the passed wp_comment

Parameters

Name Type Description Status Default
$wp_comment { WP_Comment } The wordpress comment object to encapsulate required

Example

	$wpsComment = new \WPS\Comment($wp_comment);

Author : Olivier Bossel olivier.bossel@gmail.com https://olivierbossel.com

Public

Public properties

$id

The comment id

Type : { Integer }

Public

Default : null

$post_id

The comment post id

Type : { Integer }

Public

Default : null

$ip

The comment author ip address

Type : { String }

Public

Default : null

$date

The comment datetime

Type : { String }

Public

Default : null

$date_gmt

The comment date GMT

Type : { String }

Public

Default : null

$content

The comment content

Type : { String }

Public

Default : null

$karma

The comment karma

Type : { Integer }

Public

Default : null

$approved

The comment approved status

Type : { Integer }

Public

Default : null

$agent

The comment author user agent

Type : { String }

Public

Default : null

$type

The comment type

Type : { String }

Public

Default : null

$parent

The comment parent id

Type : { Integer }

Public

Default : null

Public methods

__get

Properties accessor

Author : Olivier Bossel olivier.bossel@gmail.com https://olivierbossel.com

Public

get_post

Get the post on which this comment has been published

Return { WPS_Post } A WPS_Post object representing the post on which the comment has been published

Example

	$post = $comment->post;

Author : Olivier Bossel olivier.bossel@gmail.com https://olivierbossel.com

Public

get_author

Get the user who post the comment

Return { WPS_User } A WPS_User object representing the user who post the comment

Example

	$author = $comment->author;

Author : Olivier Bossel olivier.bossel@gmail.com https://olivierbossel.com

Public

is_approved

Check if the comment is approved or not

Return { Boolean } true if approved, false if not

Author : Olivier Bossel olivier.bossel@gmail.com https://olivierbossel.com

Public