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