PublishComment()
Description #
Run async tasks for hook ap_publish_comment.
Source #
File: includes/class-async-tasks.php
class PublishComment extends \WP_Async_Task { // phpcs:ignore
/**
* The hook name.
*
* @var string
*/
protected $action = 'ap_publish_comment';
/**
* Prepare data for the asynchronous request
*
* @param array $data Arguments.
* @return array
* @since 4.1.8
*/
protected function prepare_data( $data ) {
return array( 'comment_id' => $data[0]->comment_ID );
}
/**
* Run action.
*
* @return void
* @since 4.1.8
*/
protected function run_action() {
$comment_id = ap_sanitize_unslash( 'comment_id', 'g' );
$comment = get_comment( $comment_id );
if ( $comment ) {
do_action( "wp_async_$this->action", $comment );
}
}
}
Expand full source code Collapse full source code View on GitHub: includes/class-async-tasks.php:145
Add your comment