arraypress/wp-register-importers

WordPress library for registering CSV import operations with batch processing, field mapping, validation, and progress tracking.

Maintainers

Package info

github.com/arraypress/wp-register-importers

Homepage

pkg:composer/arraypress/wp-register-importers

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

dev-main 2026-03-10 07:56 UTC

This package is auto-updated.

Last update: 2026-03-10 07:57:02 UTC


README

A WordPress library for creating CSV import interfaces with a declarative, WordPress-style API. Define your fields, validation rules, and a single process callback — the library handles the UI, file upload, field mapping, batch processing, progress tracking, and error reporting.

Installation

composer require arraypress/wp-register-importers

Quick Start

add_action( 'init', function() {
    register_importers( 'my-plugin', [
        'page_title'  => 'Import Data',
        'menu_title'  => 'Import',
        'parent_slug' => 'my-plugin-menu',
        'operations'  => [
            'import_products' => [
                'title'       => 'Import Products',
                'description' => 'Import products from a CSV file.',
                'fields'      => [
                    'name'  => [ 'label' => 'Product Name', 'required' => true ],
                    'price' => [ 'label' => 'Price', 'type' => 'number', 'minimum' => 0.01 ],
                ],
                'process_callback' => function( array $row ) {
                    $post_id = wp_insert_post( [
                        'post_title' => $row['name'],
                        'post_type'  => 'product',
                        'post_status' => 'publish',
                    ] );
                    if ( is_wp_error( $post_id ) ) {
                        return $post_id;
                    }
                    update_post_meta( $post_id, '_price', $row['price'] );
                    return 'created';
                },
            ],
        ],
    ] );
}, 20 );

Documentation

Full documentation is available at https://arraypress.github.io/wp-register-importers

Requirements

  • PHP 8.1+
  • WordPress 6.0+

License

GPL-2.0-or-later