namespace WPForms\Tasks\Actions;
* Class AsyncRequestTask is responsible to send information in the background.
class AsyncRequestTask extends Task {
* Action name for this task.
const ACTION = 'wpforms_process_async_request';
public function __construct() {
// Task functionality is needed on cron request only.
if ( ! ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
parent::__construct( self::ACTION );
private function hooks() {
// Register the migrate action.
add_action( self::ACTION, [ $this, 'process' ] );
* Send usage tracking to the server.
* @param int $meta_id Action meta id.
public static function process( $meta_id ) {
$params = ( new Meta() )->get( $meta_id );
list( $url, $args ) = $params->data;
wp_safe_remote_get( $url, $args );