function update_fortnox_inventory_callback() { global $wpdb; // this is how you get access to the database include_once "class-woo-fortnox-controller.php"; check_ajax_referer('fortnox_woocommerce', 'security'); ob_start(); $controller = new WC_Fortnox_Controller(); $message = $controller->run_inventory_cron_job(); ob_end_clean(); echo $message; die; // this is required to return a proper result }
<?php require_once 'wp-load.php'; include_once 'wp-content/plugins/woocommerce-fortnox-integration/class-woo-fortnox-controller.php'; $fortnox_interface = new WC_Fortnox_Controller(); $fortnox_interface->run_inventory_cron_job();