pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

File fields do not display data when data migrated with migration plugins #7363

Open pdclark opened 1 month ago

pdclark commented 1 month ago

Description

Originally reported with Bricks builder in https://wordpress.org/support/topic/image-fields-not-being-copied-over-when-using-duplicate/

Found also in Yoast Duplicate Post.

Version

3.2.7

Testing Instructions

  1. Create a multi-select file field, e.g., image_field
  2. Install Yoast Duplicate Post
  3. Duplicate a post with images in the field.
  4. Note that image_field and _pods_ image_field meta keys and values exist correctly in post_meta table.
  5. Note that pods-dfv-field-data inline script JSON does not contain the data from post_meta table.

Screenshots / Screencast

inline JSON looks like this:

<script type="application/json" class="pods-dfv-field-data" data-pod="post" data-group="more_fields" data-item-id="37" data-form-counter="0">{"htmlAttr":{"id":"pods-form-ui-pods-meta-image-field","class":"pods-form-ui-field pods-form-ui-field-type-file pods-form-ui-field-name-pods-meta-image-field pods-field-template-rows","name":"pods_meta_image_field","name_clean":"pods-meta-image-field"},"fieldType":"file","fieldItemData":[],"fieldConfig":{"object_type":"field","object_storage_type":"post_type","name":"image_field","id":37,"parent":5,"group":"group\/5\/more_fields","label":"Image Field","description":"","weight":5,"type":"file","file_format_type":"multi","file_uploader":"attachment","file_type":"images","file_attachment_tab":"upload","file_attachment_current_post_only":"0","file_upload_dir":"wp","file_edit_title":"1","file_show_edit_link":"0","file_linked":"0","file_limit":0,"file_field_template":"rows","file_add_button":"Add File","file_modal_title":"Attach a file","file_modal_add_button":"Add File","file_wp_gallery_link":"file","file_wp_gallery_columns":"3","file_wp_gallery_size":"thumbnail","file_auto_set_featured_image":"0","repeatable":false,"repeatable_format":"default","default_evaluate_tags":"0","default_empty_fields":"0","roles_allowed":"administrator","revisions_revision_field":"0","enable_conditional_logic":"0","rest_pick_response":"array","rest_pick_depth":"1","required":"0","required_help_boolean":"0","name_prefix":"pods_meta_","help":"","default":null,"attributes":null,"class":"","grouped":0,"file_allowed_extensions":"","file_upload_dir_custom":"","file_restrict_filesize":"","file_wp_gallery_output":"","file_wp_gallery_random_sort":"","file_post_id":null,"limit_types":"image\/jpeg,image\/png,image\/gif,image\/webp","limit_extensions":"jpg,jpeg,png,gif,webp","groups":[],"fields":[],"repeatable_add_new_label":"Add New","repeatable_reorder":true,"repeatable_limit":0,"repeatable_format_separator":", ","item_id":37,"placeholder":""},"fieldEmbed":true,"fieldValue":false}</script>**

But should look like this:

<script type="application/json" class="pods-dfv-field-data" data-pod="post" data-group="more_fields" data-item-id="1" data-form-counter="0">{"htmlAttr":{"id":"pods-form-ui-pods-meta-image-field","class":"pods-form-ui-field pods-form-ui-field-type-file pods-form-ui-field-name-pods-meta-image-field pods-field-template-rows","name":"pods_meta_image_field","name_clean":"pods-meta-image-field"},"fieldType":"file","fieldItemData":[{"id":"28","icon":"http:\/\/yo.local\/wp-content\/uploads\/2024\/10\/333-150x150.png","name":"333","edit_link":"http:\/\/yo.local\/wp-admin\/post.php?post=28&action=edit","link":"http:\/\/yo.local\/hello-world\/333\/","download":"http:\/\/yo.local\/wp-content\/uploads\/2024\/10\/333.png","selected":true},{"id":"29","icon":"http:\/\/yo.local\/wp-content\/uploads\/2024\/10\/777-150x150.jpeg","name":"777","edit_link":"http:\/\/yo.local\/wp-admin\/post.php?post=29&action=edit","link":"http:\/\/yo.local\/hello-world\/attachment\/777\/","download":"http:\/\/yo.local\/wp-content\/uploads\/2024\/10\/777.jpeg","selected":true}],"fieldConfig":{"object_type":"field","object_storage_type":"post_type","name":"image_field","id":1,"parent":5,"group":"group\/5\/more_fields","label":"Image Field","description":"","weight":5,"type":"file","file_format_type":"multi","file_uploader":"attachment","file_type":"images","file_attachment_tab":"upload","file_attachment_current_post_only":"0","file_upload_dir":"wp","file_edit_title":"1","file_show_edit_link":"0","file_linked":"0","file_limit":0,"file_field_template":"rows","file_add_button":"Add File","file_modal_title":"Attach a file","file_modal_add_button":"Add File","file_wp_gallery_link":"file","file_wp_gallery_columns":"3","file_wp_gallery_size":"thumbnail","file_auto_set_featured_image":"0","repeatable":false,"repeatable_format":"default","default_evaluate_tags":"0","default_empty_fields":"0","roles_allowed":"administrator","revisions_revision_field":"0","enable_conditional_logic":"0","rest_pick_response":"array","rest_pick_depth":"1","required":"0","required_help_boolean":"0","name_prefix":"pods_meta_","help":"","default":null,"attributes":null,"class":"","grouped":0,"file_allowed_extensions":"","file_upload_dir_custom":"","file_restrict_filesize":"","file_wp_gallery_output":"","file_wp_gallery_random_sort":"","file_post_id":null,"limit_types":"image\/jpeg,image\/png,image\/gif,image\/webp","limit_extensions":"jpg,jpeg,png,gif,webp","groups":[],"fields":[],"repeatable_add_new_label":"Add New","repeatable_reorder":true,"repeatable_limit":0,"repeatable_format_separator":", ","item_id":1,"placeholder":""},"fieldEmbed":true,"fieldValue":[28,29]}</script>

fieldValue is false instead of array of integers and URLs are missing.

Possible Workaround

Clearing Pods cache didn't resolve it.

Site Health Information

No response

Pods Package

No response