Search
 
SCRIPT & CODE EXAMPLE
 

PHP

cron job every 5 minutes wordpress

// You can create new schedule times via cron_schedules:
function my_cron_schedules($schedules){
    if(!isset($schedules["5min"])){
        $schedules["5min"] = array(
            'interval' => 5*60,
            'display' => __('Once every 5 minutes'));
    }
    if(!isset($schedules["30min"])){
        $schedules["30min"] = array(
            'interval' => 30*60,
            'display' => __('Once every 30 minutes'));
    }
    return $schedules;
}
add_filter('cron_schedules','my_cron_schedules');

//Now you can schedule your function:
add_action( 'sw_cron_hook', 'my_cron_schedules' );
if ( ! wp_next_scheduled( 'sw_cron_hook' ) ) {
    wp_schedule_event( time(), '5min', 'sw_cron_hook' );
}
Comment

PREVIOUS NEXT
Code Example
Php :: 2 days left format in laravel 
Php :: how to get the size of an uploaded file in laravel 
Php :: check if input file is empty in php 
Php :: empty in php 
Php :: Drupal 8 custom form image field 
Php :: laravel adding condition to relation 
Php :: laravel basic login 
Php :: laravel create resource 
Php :: display name cat product woocommerce 
Php :: defining constant in config laravel 
Php :: resize image using intervention laravel and save 
Php :: display php error 
Php :: cakephp login session 
Php :: laravel rate limit 
Php :: laravel custom abort message 
Php :: php xml parser 
Php :: run composer with specific php version 
Php :: mktime() php 
Php :: catch warning php 
Php :: Override the route parameter names 
Php :: php increment variable 
Php :: php huruf besar di awal 
Php :: php encrypt password 
Php :: laravel hash password sample 
Php :: windows list registered applications 
Php :: get last name user 
Php :: limit wordpress search to title 
Php :: php trait example 
Php :: php configuration file location in centos 8 
Php :: laravel filter 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =