Tribe__Events__Aggregator__Record__Abstract::log_error( WP_Error $error )
Logs an error to the comments of the Record post
Contents
Parameters
- $error
-
(WP_Error) (Required) Error message to log.
Return
(bool)
Source
File: src/Tribe/Aggregator/Record/Abstract.php
public function log_error( WP_Error $error ) {
$today = getdate();
$args = array(
'number' => 1,
'date_query' => array(
array(
'year' => $today['year'],
'month' => $today['mon'],
'day' => $today['mday'],
),
),
);
// Tries To Fetch Comments for today
$todays_errors = $this->get_errors( $args );
if ( ! empty( $todays_errors ) ) {
return false;
}
$args = array(
'comment_post_ID' => $this->id,
'comment_author' => $error->get_error_code(),
'comment_content' => $error->get_error_message(),
'comment_type' => Tribe__Events__Aggregator__Errors::$comment_type,
);
return wp_insert_comment( $args );
}