Manually trigger a wp_schedule_event item?
Why not just to do_action($hook) of your cronned event?
Why not just to do_action($hook) of your cronned event?
Just a guess, but try to set this one in your wp-config.php // make use of redirect rather than http loopback define ( ‘ALTERNATE_WP_CRON’, true );
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
The WordPress cron is run by the wp_cron() function, which is hooked to run on the init hook, which runs on every page load. wp_cron() is defined in wp-includes/cron.php and hooked in wp-includes/default-filters.php. The wp_cron() function kicks off a wp_remote_post() request to /wp-cron.php. Some server configurations prevent scripts sending a request to the same domain … Read more
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
custom cron interval is not working
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
If what you are seeing are hits to /wp-cron.php, there is nothing really that prevents a plugin or malicious bots from making a request to that file, with or without DISABLE_WP_CRON set to true, but with it set to TRUE the actual cron process should be killed.
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
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