schedule_noptin_background_action()
Schedule an action to run once at some defined point in the future.
Description Description
This is similar to do_noptin_background_action()
except that the background task fires in the future instead of immeadiately.
You can pass extra arguments to the hooks, much like you can with do_action()
.
Example usage:
// The action callback function.
function log_name( $name ) {
// Log the name.
log_noptin_message( $name, 'notice' );
}
add_action( 'log_name_after_a_day', 'log_name', 10, 1 );
// Ask Noptin to fire the hook in in the future.
schedule_noptin_background_action( strtotime( '+1 day' ), 'log_name_after_a_day', 'Brian');
See also See also
Parameters Parameters
- $timestamp
(int) (Required) (required) The Unix timestamp representing the date you want the action to run. Default: none.
- $tag
(string) (Required) (required) Name of the action hook. Default: none.
- $arg
(mixed) (Optional) Additional arguments to pass to callbacks when the hook triggers. Default none. @return int|bool The action id on success. False otherwise.
Source Source
File: includes/functions.php
function schedule_noptin_background_action() { $args = func_get_args(); $timestamp = array_shift( $args ); return create_noptin_task( $args )->do_once( $timestamp ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.2.7 | Introduced. |