Title: Run Export from a Function
Last modified: October 8, 2019

---

# Run Export from a Function

 *  [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/)
 * Hi guys!
 * I am customizing my website and I would like to be able to run an Export from
   within a function that I am writing. How can I make the call for this?
 * Thank you very much in advance!

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/run-export-from-a-function/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/run-export-from-a-function/page/2/?output_format=md)

 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12011303)
 * hi
 * Could you try this code ?
    thanks, Alex
 *     ```
       $_REQUEST['profile'] = 'now';
       WC_Order_Export_Ajax::run_one_job();
       die();
       ```
   
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012221)
 * Hi Alex!
 * I tried the code, but I get this php error:
 * “Call to undefined method WC_Order_Export_Ajax::run_one_job()”
 * What could be the issue?
 * Thanks!
    Tamas
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012502)
 * hi Tamas
 * The plugin loads in backend context only, by default.
 * Can it be a reason ?
    -  This reply was modified 6 years, 7 months ago by [algol.plus](https://wordpress.org/support/users/algolplus/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012595)
 * Could you edit file “woo-order-export-lite.php” and comment these lines ?
 *     ```
       if ( ! woe_check_running_options() ) {
           return;
       } //don't load for frontend !
       ```
   
 * Will you still see the error ?
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012853)
 * Hi Alex
 * I am running the code from the functions.php and it is triggered by a button 
   in the backend.
 * I did what you said and I still get the same error.
 * What I want basically is to have an “Export” button on the Order List Page in
   the admin panel, that downloads the xls with the settings defined by the plugin
   page.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012925)
 * Can you try this solution [https://wordpress.org/support/topic/copy-export-button-to-frontend/#post-11644593](https://wordpress.org/support/topic/copy-export-button-to-frontend/#post-11644593)?
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012960)
 * I already did.
 * Unfortunately nothing is happening when I push the button.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012977)
 * try to replace
    ** action=”/wp-admin/admin-ajax.php”** with full url
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12012983)
 * Ok, I did. Unfortunately still nothing is happening.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12013083)
 * is there js code which prevents submitting the form?
 * You can construct link too , something like
 * [http://yoursite.com/wp-admin/admin-ajax.php?action=order_exporter&method=run_one_job&profile=now](http://yoursite.com/wp-admin/admin-ajax.php?action=order_exporter&method=run_one_job&profile=now)
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12013156)
 * I checked but I didn’t find any code preventing it. I disabled all plugins except
   Woocommerce and Advanced Order Export and still nothing.
 * I tried to construct the link as well and it gives an empty white page with ‘
   0’ on it.
 * **UPDATE**
 * I tried the link again and something happened, because now it is working. The
   function is still not working though. How could I assign the link elegantly to
   a button then?
    -  This reply was modified 6 years, 7 months ago by [tom3r](https://wordpress.org/support/users/tom3r/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12013228)
 * the link/button works only if you’re logged in.
 * [https://www.w3docs.com/snippets/html/how-to-create-an-html-button-that-acts-like-a-link.html](https://www.w3docs.com/snippets/html/how-to-create-an-html-button-that-acts-like-a-link.html)
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12013282)
 * That is no problem, in fact it should only work when user is logged in and clicks
   the button on the admin panel. Thanks for the link.
 * Do you have any idea why the function call is not working? That would be the 
   best way to go about it.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12013332)
 * I can’t write JS code for you 😉
 * run Firefox debugger and check event listeners for the form/button
 *  Thread Starter [tom3r](https://wordpress.org/support/users/tom3r/)
 * (@tom3r)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/#post-12013492)
 * I am not sure what am I looking at in the event listener, or how to find an indication
   to the form.
 * Well, at least the link construct works and I can have the job done that way.
   Thanks a lot for everything Alex!

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/run-export-from-a-function/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/run-export-from-a-function/page/2/?output_format=md)

The topic ‘Run Export from a Function’ is closed to new replies.

 * ![](https://ps.w.org/woo-order-export-lite/assets/icon-256x256.png?rev=1365554)
 * [Advanced Order Export For WooCommerce](https://wordpress.org/plugins/woo-order-export-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-order-export-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-order-export-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-order-export-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-order-export-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-order-export-lite/reviews/)

 * 16 replies
 * 2 participants
 * Last reply from: [algol.plus](https://wordpress.org/support/users/algolplus/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/run-export-from-a-function/page/2/#post-12013532)
 * Status: not resolved