Cron inside a plugin
-
Hello, I am working on a plugin that imports data every hour if there are new files to process. I am trying to use wp_schedule_event and it does not fire the function.
/** * Plugin activation */ function gpi_saxo_activation() { wp_schedule_event( time(), 'hourly', 'gpi_saxotech_import'); } register_activation_hook(__FILE__, 'gpi_saxo_activation'); add_action('gpi_saxotech_import', 'gpi_hourly_import'); /** * Plugin deactivation */ function gpi_saxo_deactivation() { wp_clear_scheduled_hook('gpi_saxotech_import'); } register_deactivation_hook(__FILE__, 'gpi_saxo_deactivation'); /** * GPI hourly import */ function gpi_hourly_import() { $xml_files = ''; //$xml_files = gpi_get_all_files(); if($xml_files) { //$parsed = gpi_parse_xml($xml_files); wp_create_category('Successfully created XML file'); } else { wp_create_category('WFailure to create XML file'); } }
Can someone give me an idea to what is wrong?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Cron inside a plugin’ is closed to new replies.