Website Building
WP All Import
4min
with wp all import modules in make, you can watch for new imports and exports to use the wp all import modules, you must have a wp all import account you can create an account at wpallimport com https //www wpallimport com/ you must also have a wordpress account with wp all import and wp all export plugins set up wp all import webhooks log in to your make account, add one of the wp all import instant modules to your {{scenario singular lowercase}} , and click create a webhook optional enter a name for the webhook in the webhook name field click save > copy address to clipboard log in to your wordpress account https //wordpress com/log in/ depending on the instant module you chose in step 1, click on either the all import or all export plugin > settings depending on the plugin you are using, paste the relevant function in the function editor field locate the wp remote post("https //hook make com/\<webhook id>", $args); line in the function you pasted and replace https //hook make com/\<webhook id> with the address copied in step 3 click save functions all import function import \<?php function after import($import id, $import) { global $wpdb; $table = $wpdb >prefix "pmxi imports"; // retrieve the import data from the database $import data = $wpdb >get row($wpdb >prepare("select from `$table` where `id` = %d", $import id), array a); // check if the import data was found if ($import data) { // check if the 'options' field is set and unserialize it if (isset($import data\['options'])) { $import data\['options'] = unserialize($import data\['options']); } } // define the http request arguments $args = array( 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1 0', 'blocking' => true, 'headers' => array(), 'cookies' => array(), 'body' => $import data, ); // sends import data to the webhook url specified wp remote post("https //hook make com/\<webhook id>", $args); } add action('pmxi after xml import', 'after import', 10, 2); ?> all export function export \<?php function after export($export id, $export) { // check whether "secure mode" is enabled in all export > settings $is secure export = pmxe plugin getinstance() >getoption('secure'); if (!$is secure export) { $filepath = get attached file($export >attch id); } else { $filepath = wp all export get absolute path($export >options\['filepath']); } $wp uploads = wp upload dir(); $fileurl = str replace($wp uploads\['basedir'], $wp uploads\['baseurl'], $filepath); $body = (array) $export; // add export file details to the body if the file exists if (file exists($filepath)) { $body\['export file url'] = $fileurl; $body\['file name'] = basename($filepath); $body\['file type'] = wp all export get export format($export >options); $body\['export trigger type'] = empty($ get\['export key']) ? 'manual' 'cron'; } // define the http request arguments $args = array( 'method'=> 'post', 'body'=> $body, 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1 0', 'blocking'=> true, 'headers'=> array(), 'cookies'=> array(), ); // sends export data to the webhook url specified wp remote post("https //hook make com/\<webhook id>", $args); } add action('pmxe after export', 'after export', 10, 2); ?> wp all import will now send data to through the webhook when the selected event occurs build wp all import {{scenario plural}} you can perform the following acti with wp all import modules triggers watch new import watch new export