0

The Cron job has more data's which creates entry everytime when a page is loaded. So i tried to get a solution by searching about it. I got some clarifications. But no solution for my problem.

Many said to disable the wp-cron and create custom Linux cpanel based cronjob. But I feel to go with Existing WordPress one.

So i Googled again to get a solution. Someone told that, when you hook your wp_schedule_event function on the time of plugin activation.But I am using here in my theme.Is there any code available to schedule my cron job should be hooked only once, when the theme is activated like that.

Here is a piece of code which I get it. Don't know how to hook it better.

event_scheduler() {

    wp_schedule_event(time(), 'daily', 'kv_daily_post_expire_check');

}
add_action('hook to run only once on the time of theme activation ', 'event_scheduler');
  • How often do you want your job to be run? Only one time? Or one time a day? – flomei Nov 26 '15 at 10:08
  • the function should work daily once. that's y i used daily there in the function itself. – Kvvaradha Nov 26 '15 at 10:18
  • after_switch_theme – TheDeadMedic Nov 26 '15 at 11:42
  • I tried it. But it creates entries. Need something which can run only once than it won't work again. – Kvvaradha Nov 26 '15 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.