Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/affinite/affinite-block-theme-migration/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Export and import FSE templates, synced blocks, template parts, global styles, and any post type between WordPress sites.
Features
Block Theme Migration
Migrate Full Site Editing (FSE) data between WordPress installations:
wp_template– FSE templateswp_template_part– template parts (header, footer, sidebar)wp_block– synced blocks / patternswp_global_styles– global styleswp_postmeta– meta recordswp_term_relationships– theme bindings (wp_theme taxonomy)
Key capabilities:
- ID Remapping: Automatically remaps `` to new IDs across ALL posts on the site
- Conflict Resolution: Existing records with the same slug are overwritten
- Term Relationships: Transfers wp_theme taxonomy bindings
Posts Migration
Export and import any post type with full postmeta support:
- Export all posts of a selected post type (page, post, custom post types)
- Full postmeta export/import
- Updates existing posts by matching ID
- Replaces all postmeta on import
Use case: Sync content between staging and production environments where posts have the same IDs.
Installation
- Upload the plugin to
/wp-content/plugins/affinite-block-theme-migration/ - Activate the plugin through the 'Plugins' menu in WordPress
- Navigate to Block Migration in the admin menu
Usage
Block Theme Migration
- Install the plugin on both source and target sites
- On the source site: Block Migration → Export → select types → download JSON
- On the target site: Block Migration → Import → upload JSON
Posts Migration
- On the source site: Block Migration → Export posts → select post type → download JSON
- On the target site: Block Migration → Import posts → upload JSON
Note: Posts import updates existing posts by ID. If a post with the given ID doesn't exist on the target site, it will be skipped.
Hooks
// Filter exported block theme data
add_filter( 'abtm_export_data', function( $data ) {
return $data;
});
// Filter data before block theme import
add_filter( 'abtm_pre_import_data', function( $data ) {
return $data;
});
// Action after block theme import completes
add_action( 'abtm_import_complete', function( $stats, $id_map ) {
// $stats: ['inserted' => int, 'updated' => int, 'remapped' => int]
// $id_map: [old_id => new_id, ...]
}, 10, 2 );
// Add additional post types to block theme migration
add_filter( 'abtm_post_types', function( $types ) {
$types[] = 'my_custom_type';
return $types;
});
Requirements
- WordPress 6.0+
- PHP 7.4+
manage_optionscapability (Administrator role)
Changelog
1.0.0
- Initial release
- Block theme migration (templates, template parts, synced blocks, global styles)
- Posts migration with postmeta support
- Automatic ID remapping for synced block references
License
GPLv2 or later