WordPress.org

Ready to get started?Download WordPress

Forums

Stuck on scheduling and cron (1 post)

  1. nofearinc
    Member
    Posted 2 years ago #

    Hello everyone,

    I got stuck on scheduling in WP and cron jobs. I need to set a 10min event that calls a function in my class. Basically so far I have a function in the class that does this:

    private function configureExporter() {
    		$this->cronActivation();
    
    		add_action('cron_exporter', array(&$this, 'cronExporter'));
    	}
    
    private function cronActivation() {
    		if ( !wp_next_scheduled( 'cron_exporter' ) ) {
    			wp_schedule_event(time(), 'hourly', 'cron_exporter');
    		}
    	}
    
    public function cronExporter() {
    		// demo, file export, update_option(...)
    }

    My Exporter function isn't called. I prefer the 'hourly' option to be set by myself for test purposes, but I didn't find a way.

    Any tips on when I could be wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic