-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Hey, great code, thanks!
I'm having some trouble using it, though. Here's a quick test I'm doing:
add_action( 'wp_async_shutdown', [$this, 'testing_async'], 10, 1 );
I expect this to run public function testing_async() asynchronously when WordPress be shutting down, right?
public function testing_async() {
error_log('test', 1, 'someemail@gmail.com');
}
But this is never called. OK, this didn't work. Let's try the "extend class" approach.
public function testing_async() {
$test = new WP_Async_Test();
}
WP_Async_Test.php:
<?php
class WP_Async_Test extends WP_Async_Task {
//protected $action = 'shutdown';
protected $action = 'testing_async';
/**
* Prepare data for the asynchronous request
*
* @throws Exception If for any reason the request should not happen
*
* @param array $data An array of data sent to the hook
*
* @return array
*/
protected function prepare_data( $data ) {
}
/**
* Run the async task action
*/
protected function run_action() {
error_log('hi', 1, 'someemail@gmail.com');
}
}
This didn't work either... What am I doing wrong?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels