Content transfer hooks
This page lists the 7 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.
adba_transfer_export_itemadba_transfer_exportedadba_transfer_import_itemadba_transfer_importedadba_transfer_meta_excludeadba_transfer_register_sourcesadba_transfer_types
adba_transfer_export_item
FilterSince 2.26.0 Runs in src/Modules/Transfer/Exporter.php.
Filters an exported item before it goes into the file. Add fields of your own here and read them back in adba_transfer_import_item.
| Argument | Type | Description |
|---|---|---|
$item | array<string, mixed> | Item. |
$post | \WP_Post | Source post. |
add_filter( 'adba_transfer_export_item', function ( $item, $post ) {
return $item;
}, 10, 2 );
adba_transfer_exported
ActionSince 2.26.0 Runs in src/Modules/Transfer/Runner.php.
Fires after an export file was written.
| Argument | Type | Description |
|---|---|---|
$file | string | Absolute path of the export file. |
$job | array<string, mixed> | The export job. |
add_action( 'adba_transfer_exported', function ( $file, $job ) {
// ...
}, 10, 2 );
adba_transfer_import_item
FilterSince 2.26.0 Runs in src/Modules/Transfer/Importer.php.
Filters an item before it is imported. Return null to skip it.
| Argument | Type | Description |
|---|---|---|
$item | array<string, mixed>|null | Item from the file. |
$mode | string | update or new. |
$target | int | Id that is updated, 0 for a new item. |
add_filter( 'adba_transfer_import_item', function ( $item, $mode, $target ) {
return $item;
}, 10, 3 );
adba_transfer_imported
ActionSince 2.26.0 Runs in src/Modules/Transfer/Importer.php.
Fires after an import finished.
| Argument | Type | Description |
|---|---|---|
$report | array<string, mixed> | created, updated, skipped and failed (title, reason). |
$job | array<string, mixed> | The import job. |
add_action( 'adba_transfer_imported', function ( $report, $job ) {
// ...
}, 10, 2 );
adba_transfer_meta_exclude
FilterSince 2.26.0 Runs in src/Modules/Transfer/MetaFilter.php.
Filters the meta keys left out of a content export and ignored on import. Patterns are fnmatch() globs, like '_my_plugin_cache_*'. Remove a pattern to let a key travel after all.
| Argument | Type | Description |
|---|---|---|
$patterns | string[] | Key patterns. |
add_filter( 'adba_transfer_meta_exclude', function ( $patterns ) {
return $patterns;
} );
adba_transfer_register_sources
ActionSince 2.36.0 Runs in src/Modules/Transfer/Sources.php.
Register sources for Tools > Content: data that is no post, product or term. Call $sources->add() with an object that implements AddoBack\Modules\Transfer\TransferSource.
| Argument | Type | Description |
|---|---|---|
$sources | Sources | The register. |
add_action( 'adba_transfer_register_sources', function ( $sources ) {
// ...
} );
adba_transfer_types
FilterSince 2.26.0 Runs in src/Modules/Transfer/Types.php.
Filters the content types that can be exported and imported. Add a post type with kind 'post', a post_type, a cap and the taxonomies that travel with it, or a taxonomy with kind 'term' under the id 'term:{taxonomy}'. Kind 'product' is reserved for WooCommerce products.
| Argument | Type | Description |
|---|---|---|
$types | array<string, array<string, mixed>> | Types by id. |
add_filter( 'adba_transfer_types', function ( $types ) {
return $types;
} );