wp-cron.php is triggered, but scheduled post is not published

The _get_cron_array() function gets the ‘cron’ option out of the database. The cron option contains an array consisting of a series of unix-timestamps and action hooks. So, when the timestamp is reached, then the action hook is called. The timestamp of 1465529020 is the equivalent of June 10th, 2016, at 3:23am in UTC time. The … Read more

Run WP Cron Weekly (but on a certain day)

WP-Cron is not intended to be that precise, and should not be used if you have to have things scheduled at specific times. WP-Cron is a “best effort” scheduling mechanism, and it cannot guarantee run timing like a real cron system can. If you need precision of this nature, the only real answer is to … Read more

wp_delete_auto_drafts() deletes links in menus

This is what normal query run by wp_get_associated_nav_menu_items() looks like: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.id = wp_postmeta.post_id ) WHERE 1 = 1 AND wp_posts.post_type=”nav_menu_item” AND (( wp_posts.post_status <> ‘trash’ AND wp_posts.post_status <> ‘auto-draft’ )) AND (( wp_postmeta.meta_key = ‘_menu_item_object_id’ AND Cast(wp_postmeta.meta_value AS CHAR) = ‘3111’ )) GROUP BY wp_posts.id ORDER … Read more

When does next Cron Job run (time from now)?

Edit: wp_next_scheduled() returns the timestamp of the next scheduled job of a specified wp-cron job-arguments pair. Please note that this differs slightly in functionality to the answer below, in that you have to provide the arguments passed to cron job’s callback (if it has any). The original answer would provide the time of the next … Read more

Cron jobs in a class

I was working with wp_cron last week in a plugin and we have a fight and are no longer on speaking terms, but for reference this is what I do; 1) – set the scheduled cron event on register_activation_hook 2) – remove the scheduled cron event on register_deactivation_hook If you are concerned that your scheduled … Read more

add_action to wp cron?

Basically every page load looks to see if there is anything scheduled to run, so by that logic the cron is checked and can possibly run on every page load. I can only presume you want to schedule something to run every so often. If that’s the case you need to look at wp_schedule_event() Below … Read more

wp_schedule_event won’t accept args

This is not a fix for your problem, but it might lead you in the right direction to solving the issue. I would suggest checking out this plugin to possibly help you find out what is going on: WP Cron Control It offers a quick view of cron jobs scheduled throughout your site. I recently … Read more

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