How ( and mostly at what time ) can i prevent the alternate cron from running?
How ( and mostly at what time ) can i prevent the alternate cron from running?
How ( and mostly at what time ) can i prevent the alternate cron from running?
wp_schedule_single_event function not working
Not sure the exact answer but I have a theory that it is a 24 hour window. You can get around relying on wp-cron and someone visiting your site every day by having your server handle your cron. Assuming you have cpanel, it’s fairly easy to do. Then just have this run every 12 or … Read more
First can you please confirm that you don’t have any caching plugins enabled? Caching plugins can interfere with cron jobs because your visitors are not served a live page but a cached version of your page. If you have a caching plugin enabled, you can choose one of your pages, add an exclusion to your … Read more
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
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
First of all, think about using the new REST API instead of Admin-AJAX in your environment where JavaScript is available. Now to answer your question: JavaScript isn’t available for wp-cron, as these requested solely run on the server and not on some interpreted HTML/JavaScript. So what can you do? Well, just schedule another event if … Read more
Two most important notes to your code. It’s not working, because always will be retrieved only 5 (the default value of ‘post_per_page’ parameter) recent posts. If you want to add a task to the cron, you do not specify the function name as the parameter, but the name of the action hook. And you attach … Read more
I would filter which posts go into the option, that’s light enough processing that it can be done on that end. To get the content of the post you can use get_post( $v );. To get the metavalues for the post you can use get_post_custom( $v );. To update the meta values you will use … Read more
The cron event needs to be registered on the plugin activation hook like so: register_activation_hook( __FILE__, ‘activate_cron’ ); function activate_cron() { wp_schedule_event( current_time( ‘timestamp’ ), ‘hourly’, ‘the_function_to_run’ ); } The the_function_to_run defined in the wp_schedule_event needs to be your function that you want to run at the time interval. Note: When you say something is … Read more