AdvancedCustomFields / AdvancedCustomFields/acf
Clone Field within ACF 5.8.0-beta3 Block not displaying value in backend but saves correctly in post_content
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Issue
The values for multiple clone fields on a page will save in the post_content but on refresh will not render as values in the input. My understanding is that the Clone fields will have the same Field Names and Keys (which is still applicable if 'prefix' is set) which I would think would conflict but non-clone fields with the same Field Names and Keys do not seem to have this same issue.
Dependencies
ACF: 5.8.0-beta3
WP: 5.0
Steps to Reproduce
- Create Hero Block field group
- Create Block Header field group with Block Title Text field and Block Description Textarea field
- Add Block Header as a Clone field within Hero Block
- Go to a page and insert two Hero Blocks
- Input text into each field then save changes
Result
- On initial save, the values remain in the fields since it's saving with an ajax request
- On refresh the fields are no longer populated
- The data for each field is saved in the post_content for the post, with the correct values within each respective Block
Below is the value that's saving under post_content
<!-- wp:acf/hero {"id":"block_5c0caebe6dc74","data":{"field_5c1d1884b4ec4":{"field_5c1d1884b4ec4_field_5c0c47739f841":"HERO BLOCK TITLE 1","field_5c1d1884b4ec4_field_5c0c4794a52ae":"HERO BLOCK DESCRIPTION 1"},"field_5c0cac3cf6fbf":{"field_5c0cac3cf6fbf_field_5c0c4914db251":"none"}},"name":"acf/hero","align":"","mode":"edit"} /-->
<!-- wp:acf/hero {"id":"block_5c1d118ae774c","data":{"field_5c1d1884b4ec4":{"field_5c1d1884b4ec4_field_5c0c47739f841":"HERO BLOCK TITLE 2","field_5c1d1884b4ec4_field_5c0c4794a52ae":"HERO BLOCK DESCRIPTION 2"},"field_5c0cac3cf6fbf":{"field_5c0cac3cf6fbf_field_5c0c4914db251":"none"}},"name":"acf/hero","align":"","mode":"edit"} /-->
Below is a screenshot of the blocks on the page after saving the above content and then refreshing the page once
Subsequent Tests:
- If I edit one of the the fields with no values displayed (though saved in the DB), the value for only that Block will be changed. Unsure if this is related, or just a product of what posts during save.
<!-- wp:acf/hero {"id":"block_5c0caebe6dc74","data":{"field_5c1d1884b4ec4":{"field_5c1d1884b4ec4_field_5c0c47739f841":"HERO BLOCK TITLE 1","field_5c1d1884b4ec4_field_5c0c4794a52ae":"HERO BLOCK DESCRIPTION 1"},"field_5c0cac3cf6fbf":{"field_5c0cac3cf6fbf_field_5c0c4914db251":"none"}},"name":"acf/hero","align":"","mode":"edit"} /-->
<!-- wp:acf/hero {"id":"block_5c1d118ae774c","data":{"field_5c1d1884b4ec4":{"field_5c1d1884b4ec4_field_5c0c47739f841":"Test 2","field_5c1d1884b4ec4_field_5c0c4794a52ae":""},"field_5c0cac3cf6fbf":{"field_5c0cac3cf6fbf_field_5c0c4914db251":"none"}},"name":"acf/hero","align":"","mode":"edit"} /-->
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with ACF 5.8.0-beta3 and WordPress 5.0 using two Hero Blocks containing the cloned Block Header fields, then compare the values after saving and refreshing. The fix is complete when each block's cloned fields render their saved values after refresh and editing one block does not affect the other.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100