WordPress cron running twice

I tried WP Crontrol instead and it turned out that two cron jobs were being created for generate_send_csv. To fix this, I created the crons within activation hooks and deactivation hooks as follows: register_activation_hook( __FILE__, ‘my_activation’ ); add_action( ‘generate_send_csv’, ‘generate_and_send_csv’ ); function my_activation() { wp_schedule_event(‘1488979800’, ‘daily’, ‘generate_send_csv’); } register_deactivation_hook( __FILE__, ‘my_deactivation’ ); function my_deactivation() { … Read more

Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?

There is no reason for your design, but the core of your problem is that (I assume) people are trying to use a free tier of the API instead of properly paying for its use and removing the ridiculous restrictions. Anyway, the solution is fairly simple, run your cron every half an hour, allocate to … Read more

Automated mark posts as featured every day

OK, so first of all you’ll need to add your own WP_Schedule event: add_action( ‘wp’, function () { if (! wp_next_scheduled ( ‘mark_posts_as_featured_event’ )) { wp_schedule_event(time(), ‘daily’, ‘mark_posts_as_featured_event’); } } ); function mark_posts_as_featured_event_callback() { // if there are sticky posts in our CPT, unstick them $sticked_post_ids = get_option( ‘sticky_posts’ ); if ( ! empty ) … Read more

execute function in wordpress plugin using crontab

I found a great solution here: Trigger a custom wordpress plugin with a linux cron My path was /usr/bin/wp so check your server. You can just add your function to a file, and using the wp bin script you don’t need to add anything to your php file to use WordPress functions. I was able … Read more