wp-cron.php – timeout

I had the same problem. My solution was to define the timeout constant for the cron job by adding this line in wp-config.php: define(‘WP_CRON_LOCK_TIMEOUT’, 60); I added this before the line require_once(ABSPATH . ‘wp-settings.php’); and it worked. By default this is set to 0.01 seconds, which to me it makes no sense. This line sets … Read more

Cron job not firing

It seems you are using your regular cron for that and it seems you are using the WP cron incorrectly in your example above. If you want to use wp cron in anything, this is the basic usage: if ( ! wp_next_scheduled( ‘wpcron_hook’ ) ) { wp_schedule_event( time(), ‘hourly’, ‘wpcron_hook’ ); } add_action( ‘wpcron_hook’, ‘delay_myposts’ … Read more

Hourly scheduled wp_cron job keeps getting rescheduled

Well….I’ve figured it out. Manually deleting everything in Crontrol didn’t help as much as I thought it had. I went to my wp_options table and deleted the entire cron entry. On refresh now, everything looked more or less how I expected, and all of my questions are answered now. When disabling WP Cron to enable … Read more

wp_schedule_single_event does not call my action

Because you’re scheduling the event – even though it’s set to run immediately (i.e. with time()), it won’t fire until a second request. So that log output is entirely expected. Try running it again, removing the code, then run once more – you should get: [time] test_action

Can you register two cron events in a single function?

It looks like Howdy_McGee pinpointed the issue in a comment on the original question: Make the new_interval() a method of your class and call the filter inside your activation hook (above the cron registrations): add_filter(‘cron_schedules’, array( $this, ‘new_interval’ ) );

How to periodically scrape and cache strings from remote txt files. – My First Plugin

The Transient API may help you here. A transient is variable stored for a defined amount of time. function filemtime_remote( $url ) { $list = file_get_contents( $url , null , null , 0 , 200); $important = explode(“Last modified: “,$list)[1]; $mydate = substr($important, 0, 21); return $mydate; } The above is your current code which … Read more

How to schedule and publish a post after it’s ready?

There might be two ways: add_action( ‘draft_post’, ‘wpse_246730_my_function’ ); function wpse_246730_my_function( $post_id, $post ) { // Do your things // Just to stay safe remove_action( ‘draft_post’, ‘wpse_246730_my_function’ ); wp_publish_post( $post_id ); add_action( ‘draft_post’, ‘wpse_246730_my_function’ ); } Or make the post future status, and set a time after 10 or 20 mins to publish. Then use … Read more

Cron schedule not updating after run

You can use wp-cli to execute schedules without the detour via http request. Add in crontab -e. */30 * * * * wp cron event run –path=/path/to/wp-docroot By this you wont run into maximum execution time problems which could be the reason why you schedule execution got stuck.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)