Solution:1
First of all , 1) You need to setup crontab in your server if you want to work dynamically 2) if you want manually wordpress scheduler will call after the page is run
so,
for the crontab setup below is useful link: crontab
Solution:1
First of all , 1) You need to setup crontab in your server if you want to work dynamically 2) if you want manually wordpress scheduler will call after the page is run
so,
for the crontab setup below is useful link: crontab
Solution:2
If you want to run your cron in every one hour then you need to add below code:
public function __construct() {
// Call function for cron
add_action('init', array( $this, 'send_emails_to_users') );
}
public function send_emails_to_users() {
if(!wp_next_scheduled('cliv_recurring_cron_job')) {
// Add "cliv_recurring_cron_job" action so it fire every hour
wp_schedule_event(time(), 'hourly', 'cliv_recurring_cron_job');
}
}
add_action('cliv_recurring_cron_job', array( $this, 'send_email') );
public function send_email() {
//send email code goes here
}