Schedule an action to run repeatedly with a specified interval in seconds.

Description Description

This is similar to schedule_noptin_background_action() except that the background task fires repeatedly.

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_every_day', 'log_name', 10, 1 );

 // Ask Noptin to fire the hook every x seconds from tomorrow.
 schedule_noptin_background_action( DAY_IN_SECONDS, strtotime( '+1 day' ), 'log_name_every_day', 'Brian');

See also See also

Top ↑

Parameters Parameters


(int) (Required) (required) How long ( in seconds ) to wait between runs. Default: none.


(int) (Required) (required) The Unix timestamp representing the date you want the action to run for the first time. Default: none.


(string) (Required) (required) Name of the action hook. Default: none.


(mixed) (Optional) Additional arguments to pass to callbacks when the hook triggers. Default none.

Top ↑

Return Return

(int|bool) The action id on success. False otherwise.

Top ↑

Source Source

File: includes/functions.php

function schedule_noptin_recurring_background_action() {
	$args      = func_get_args();
	$interval  = array_shift( $args );
	$timestamp = array_shift( $args );
	return create_noptin_task( $args )->do_recurring( $timestamp, $interval );

Top ↑

Changelog Changelog


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation