ActionScheduler_wpCommentLogger::create_wp_comment()protectedWC 1.0

Method of the class: ActionScheduler_wpCommentLogger{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->create_wp_comment( $action_id, $message, $date );
$action_id (required)
-
$message (required)
-
$date(DateTime) (required)
-

ActionScheduler_wpCommentLogger::create_wp_comment() code WC 8.7.0

protected function create_wp_comment( $action_id, $message, DateTime $date ) {

	$comment_date_gmt = $date->format('Y-m-d H:i:s');
	ActionScheduler_TimezoneHelper::set_local_timezone( $date );
	$comment_data = array(
		'comment_post_ID' => $action_id,
		'comment_date' => $date->format('Y-m-d H:i:s'),
		'comment_date_gmt' => $comment_date_gmt,
		'comment_author' => self::AGENT,
		'comment_content' => $message,
		'comment_agent' => self::AGENT,
		'comment_type' => self::TYPE,
	);
	return wp_insert_comment($comment_data);
}