-
Notifications
You must be signed in to change notification settings - Fork 27
/
pmxe_exported_post.php
37 lines (33 loc) · 1.07 KB
/
pmxe_exported_post.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* ==================================
* Action: pmxe_exported_post
* ==================================
*
* Called after a post is exported (added to the export file) by WP All Export.
*
* @param $post_id int - The id of the post just exported
* @param $exportObj SimpleXMLElement - An object holding values for the current record
*
*/
/**
* Example code to change the order status to 'completed' on exporting
*/
function wpae_pmxe_exported_post($post_id, $exportObject)
{
$order = new WC_Order($post_id);
$order->update_status('completed', 'export_completed');
}
add_action('pmxe_exported_post', 'wpae_pmxe_exported_post', 10, 2);
/**
* Example that checks the export ID
*/
function wpae_pmxe_exported_post($post_id, $exportObject)
{
$export_id = ( isset( $_GET['id'] ) ? $_GET['id'] : ( isset( $_GET['export_id'] ) ? $_GET['export_id'] : 'new' ) );
if ($export_id == "1") {
$order = new WC_Order($post_id);
$order->update_status('completed', 'export_completed');
}
}
add_action('pmxe_exported_post', 'wpae_pmxe_exported_post', 10, 2);