Developer Guide: Action Hooks and Filter Reference
Developer Hooks & Filters
Both WP Import Export and Woo Import Export provide an extensive suite of WordPress action and filter hooks allowing developers to customize every stage of data parsing, sanitization, and database insertion.
Key Filter Hooks
1. wpie_import_record_data
Runs immediately after a record is parsed from your file, before any WordPress post is created or updated.
/**
* Filter record data before import
*
* @param array $record Raw associative array of the current row
* @param int $import_id Current import ID
* @return array Modified record data
*/
add_filter( 'wpie_import_record_data', function( $record, $import_id ) {
// Custom SKU prefix logic
if ( ! empty( $record['sku'] ) ) {
$record['sku'] = 'VJI-' . strtoupper( trim( $record['sku'] ) );
}
return $record;
}, 10, 2 );
2. wpie_after_post_import
Fires after a post or WooCommerce product has been fully inserted and all metadata has been saved.
/**
* Hook after single post import
*
* @param int $post_id Created/updated post ID
* @param array $record Raw import row
*/
add_action( 'wpie_after_post_import', function( $post_id, $record ) {
// Send notification, trigger webhook, or log activity
error_log( "Successfully processed post ID: {$post_id}" );
}, 10, 2 );
