Skip to content

Pods relationships not properly duplicated during Polylang translation or XML import #7415

@benjhoo

Description

@benjhoo

Description

I've discovered an issue with Pods relationship fields not being properly duplicated when content is translated using Polylang or imported via wordpress-import.

When a post containing Pods relationship fields is translated using Polylang (or imported via XML), the metadata in wp_postmeta is correctly duplicated, but the actual relationships in the wp_podsrel table are not completely copied to the new post.

Investigation Results

When examining the database:

  1. In wp_postmeta, both the original and translated posts have identical metadata for the relationship field (except hidden field _pods_xxx with serialized data I manually had in my pll_copy_post_metas hook)

  2. However, in wp_podsrel, the relationships are not fully duplicated:

    • Original post (ID: 190) has entries for all relationships (e.g., roles 95, 97, 111)
    • Translated post (ID: 195) only has no relationships

Environment

  • WordPress version: 6.7.2
  • Pods version: 3.2.8.2
  • Polylang version: 3.6.7
  • PHP version: 8.3

Additional Information

This appears to be related to how Pods stores relationship data across two locations:

  1. Serialized metadata in wp_postmeta
  2. Relationship records in wp_podsrel

Version

3.2.8.2

Testing Instructions

  1. Create a post with a Pods relationship field (in my case, a widget with role relationships)
  2. Set multiple related items in the relationship field (for example, selecting multiple roles)
  3. Create a translation of this post using Polylang with the option to copy fields
  4. Check the translated post in the admin UI - initially no relationships appear (no checkboxes are selected in the translated version, even though all appropriate checkboxes were selected in the original).

Screenshots / Screencast

Image

Image

Image

Image

Possible Workaround

Pods could provide a hook that automatically rebuilds the relationship entries in the wp_podsrel table based on the pods* metadata that is already correctly duplicated during translation or import processes.

Site Health Information


Pods Package

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions