How to set up WP Cron in this scenario

First things first: Say hello! to $wpdb The wpdb Class is what you take to interact with the database on it’s most basic level. Forget all those mysql_* functions, when it comes to WordPress. The core has a nice wrapper, that makes most things pretty safe for you (hint: SQL-injections and other bad boys). Or … Read more

Managing scheduled tasks

It looks to me that this line add_action(‘obr_scheduled_task’, array(&$this, ‘obr_activate_scheduled_task’)); should be add_action(‘obr_scheduled_task’, array(&$this, ‘obr_scheduled_task’)); otherwise you are re-scheduling on every page visit. Edit: Here is a logger that can be useful when debugging wp-cron: function my_logger($var){ $logfile=”/tmp/logger.txt”; // EDIT this to your needs file_put_contents($logfile, date(“Y-m-d: H:i:s”,time()).” — “.print_r($var, true).”\n”, FILE_APPEND); } You can use … Read more

what is firing cron

Well, it isn’t the best tutorial I’ve came across, so I get why you’re confused… Smashing Magazine has a little bit better tutorial on this subject. Some quotes from this article that should help you understand how does WP Cron work… WordPress Cron is what many people refer to as a “pseudo-cron system.” The difference … Read more

Run a cron job (or similar) in the background of WP after post update/create

Alright, here’s some code I just whipped up. Completely untested, just wrote it right off the cuff…so don’t expect it to work 100% when you drop it in, but the core concept is there, as is a decent amount of the legwork add_action( ‘my_filter_posts_content’, ‘my_filter_content’ ); add_action( ‘save_post’, ‘my_set_content_filter’ ); if( !wp_next_scheduled( ‘my_filter_posts_content’ ) ) … Read more

WP CRON runs only the first time

OK, so I’ve tested your code and I’m pretty sure it can’t run even once… And here’s why… If you’ll take a look at wp_schedule_event you’ll see this check at the top of the function: if ( !isset( $schedules[$recurrence] ) ) return false; It means that you can’t schedule event with unknown recurrence. So let’s … Read more

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