Skip to content

Migrate Packages: remap bi-directional sister_id on import - #7584

Open
pdclark wants to merge 1 commit into
pods-framework:mainfrom
pdclark:fix/package-sister-id
Open

Migrate Packages: remap bi-directional sister_id on import#7584
pdclark wants to merge 1 commit into
pods-framework:mainfrom
pdclark:fix/package-sister-id

Conversation

@pdclark

@pdclark pdclark commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Packages store sister_id as a source-site wp_posts.ID; import could create fields with new IDs, but required re-assignment

  • export() now also emits sister_field (the sister field's name) as a portable reference; sister_id stays for backward compatibility.
  • import() maps package field IDs to pod/field names after all pods are saved; resolves each pick field's reference (by sister_field name, else by old-ID map) and saves the new sister_id. Unresolvable references are cleared to 0.

Description

See https://wordpress.org/support/topic/bi-directional-field-not-working-after-import-package/

Testing instructions

  • Export Package JSON (Download or copy textarea)
  • Delete existing Pods (to get new IDs when importing) on /wp-admin/admin.php?page=pods
  • Impot Package JSON on /wp-admin/admin.php?page=pods-component-migrate-packages (paste or upload)
  • Visit /wp-admin/admin.php?page=pods
  • Edit "CPT One"
  • Click "Edit" for each field of type Relationship
  • Field "Bi-directional Field" should have the field selected already, not requiring re-selection and re-save

Changelog text for these changes

Include bidirectional fields in Pods Package Import/Export

PR checklist

@pdclark

pdclark commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Tests

Several CI tests were resolved via composer.json: Pinned package versions so the tests could run on PHP 8.2 as expected.

One CI test was resolved via readme.txt: Plugin Checker is claiming the plugin header's minimum required WP version should be bumped to 6.5.0 due to certain functions being used.

The only remaining test,PHP Compatibility, requires some GitHub tokens/secrets to be set to run.

Package JSON

An example of the revised pods.json export is below. The addition is field key sister_field (name) in addition to sister_id

{
    "@meta": {
        "version": "3.3.9",
        "build": 1785470656
    },
    "settings": {
        "types_only": "0",
        "watch_changed_fields": "0",
        "metadata_integration": "0",
        "metadata_override_get": "0",
        "register_meta_integration": "0",
        "media_modal_fields": "0",
        "autocomplete_limit": "15",
        "session_auto_start": "0",
        "dynamic_features_allow": "1",
        "dynamic_features_enabled": [
            "display",
            "form"
        ],
        "show_access_restricted_messages": "0",
        "show_access_admin_notices": "1",
        "dynamic_features_allow_sql_clauses": "0",
        "display_callbacks": "customized",
        "display_callbacks_allowed": "esc_attr,esc_html",
        "wisdom_opt_out": "1",
        "active_components": [
            "migrate-packages",
            "templates"
        ]
    },
    "pods": [
        {
            "name": "comment",
            "id": 34,
            "label": "Comment",
            "description": "",
            "type": "comment",
            "storage": "meta",
            "object": "comment",
            "_migrated_28": "0",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 35,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "rel_cpt",
                            "id": 36,
                            "label": "Rel CPT",
                            "description": "",
                            "weight": 0,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "cpt_one",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "required": "0",
                            "sister_field": "rel_comments",
                            "sister_id": "56"
                        }
                    ]
                }
            ]
        },
        {
            "name": "cpt_one",
            "id": 37,
            "label": "CPT One",
            "description": "",
            "type": "post_type",
            "storage": "meta",
            "label_singular": "CPT One",
            "public": "1",
            "show_ui": "1",
            "publicly_queryable": "1",
            "dynamic_features_allow": "inherit",
            "rest_enable": "1",
            "supports_title": "1",
            "supports_editor": "1",
            "_migrated_28": "1",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 38,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "rel_taxonomy",
                            "id": 53,
                            "label": "Rel Taxonomy",
                            "description": "",
                            "weight": 0,
                            "type": "pick",
                            "pick_object": "taxonomy",
                            "pick_val": "taxonomy_one",
                            "sister_id": "49",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "revisions_revision_field": "0",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_cpt"
                        },
                        {
                            "name": "rel_cpt",
                            "id": 54,
                            "label": "Rel CPT",
                            "description": "",
                            "weight": 1,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "cpt_one",
                            "sister_id": "54",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "revisions_revision_field": "0",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_cpt"
                        },
                        {
                            "name": "rel_users",
                            "id": 55,
                            "label": "Rel Users",
                            "description": "",
                            "weight": 2,
                            "type": "pick",
                            "pick_object": "user",
                            "sister_id": "52",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "revisions_revision_field": "0",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_cpt"
                        },
                        {
                            "name": "rel_comments",
                            "id": 56,
                            "label": "Rel Comments",
                            "description": "",
                            "weight": 3,
                            "type": "pick",
                            "pick_object": "comment",
                            "sister_id": "36",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "revisions_revision_field": "0",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_cpt"
                        },
                        {
                            "name": "rel_media",
                            "id": 57,
                            "label": "Rel Media",
                            "description": "",
                            "weight": 4,
                            "type": "pick",
                            "pick_object": "media",
                            "sister_id": "46",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "revisions_revision_field": "0",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_cpt"
                        }
                    ]
                }
            ]
        },
        {
            "name": "media",
            "id": 44,
            "label": "Media",
            "description": "",
            "type": "media",
            "storage": "meta",
            "object": "media",
            "_migrated_28": "0",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 45,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "rel_cpt",
                            "id": 46,
                            "label": "Rel CPT",
                            "description": "",
                            "weight": 0,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "cpt_one",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_media",
                            "sister_id": "57"
                        }
                    ]
                }
            ]
        },
        {
            "name": "taxonomy_one",
            "id": 47,
            "label": "Taxonomy Ones",
            "description": "",
            "type": "taxonomy",
            "storage": "meta",
            "label_singular": "Taxonomy One",
            "public": "1",
            "show_ui": "1",
            "hierarchical": "1",
            "publicly_queryable": "1",
            "dynamic_features_allow": "inherit",
            "rest_enable": "1",
            "_migrated_28": "0",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 48,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "rel_cpt",
                            "id": 49,
                            "label": "Rel CPT",
                            "description": "",
                            "weight": 0,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "cpt_one",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_taxonomy",
                            "sister_id": "53"
                        }
                    ]
                }
            ]
        },
        {
            "name": "user",
            "id": 50,
            "label": "User",
            "description": "",
            "type": "user",
            "storage": "meta",
            "object": "user",
            "_migrated_28": "0",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 51,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "rel_cpt",
                            "id": 52,
                            "label": "Rel CPT",
                            "description": "",
                            "weight": 0,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "cpt_one",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_sync_taxonomy": "0",
                            "pick_sync_taxonomy_hide_taxonomy_ui": "0",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "default_evaluate_tags": "0",
                            "default_empty_fields": "0",
                            "roles_allowed": "administrator",
                            "enable_conditional_logic": "0",
                            "conditional_logic_save_value": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "required": "0",
                            "sister_field": "rel_users",
                            "sister_id": "55"
                        }
                    ]
                }
            ]
        }
    ]
}

@pdclark
pdclark force-pushed the fix/package-sister-id branch from c5d5c42 to ca58b1a Compare July 31, 2026 18:27
Packages store sister_id as a source-site wp_posts.ID; import could create
fields with new IDs, but required re-assignment

- export() now also emits sister_field (the sister field's name) as a
  portable reference; sister_id stays for backward compatibility.
- import() maps package field IDs to pod/field names
  after all pods are saved; resolves each pick field's
  reference (by sister_field name, else by old-ID map) and saves the
  new sister_id. Unresolvable references are cleared to 0.

composer.json, re: CI environment requirements:

- webonyx/graphql-php set to ignore PKSA advisories for 15.29.3. Testing only; package should be updated / advisories resolved for production. Caused by a dependency of wp-graphql.
- wpsentex/polylang changed from dev-master to ^3.8.6, CI blocked use of dev-* tag (stability requirement).
- fzaninotto/faker was archived in 2020 and capped at PHP 7.

--ignore-platform-reqs allowed environment requirements to be ignored
Slic container testing environment is PHP 8.2
symfony/console therefore installed at version 8, which uses PHP 8.5-only syntax.
Removing --ignore-platform-reqs from .github/workflows/tests-php.yml
would likely also resolve with fewer explicit declarations.

This composer.json switches to fakerphp/faker, which allows PHP 8, and pins symfony packages to install at version 7, supporting the environment requirement of PHP 8.2.

readme.txt:
Require WP 6.5 according to wordpress/plugin-check-action@v1 CI test
@pdclark
pdclark force-pushed the fix/package-sister-id branch from ca58b1a to 3c9ebf5 Compare July 31, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant