AdvancedCustomFields / AdvancedCustomFields/acf

WYSIWYG fields in ACF Blocks don't save without switching to Preview first

Open
#999 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Description

WYSIWYG fields inside ACF Blocks (particularly when nested in repeaters or groups) silently lose their content when saving the post. The content is only persisted if the user manually switches the block to "Preview" mode before saving.

Steps to Reproduce

  1. Create an ACF Block with a repeater field containing a WYSIWYG sub-field
  2. Add the block to a post in the Gutenberg editor
  3. Add a repeater row and type content into the WYSIWYG field
  4. Click "Save" (without switching the block to Preview first)
  5. Reload the page — the WYSIWYG content is gone

Expected Behavior

WYSIWYG field content should be saved regardless of whether the block is in Edit or Preview mode.

Actual Behavior

Content typed into WYSIWYG fields is lost on save unless the block is switched to Preview mode first. Other field types (text, select, etc.) save correctly.

Root Cause

In acf-pro-blocks.js, the BlockForm.componentDidAppend() method binds change detection to the block wrapper:

// ACF source (deobfuscated):
i.on("change keyup", () => {
    clearTimeout(a);
    a = setTimeout(s, 300);  // s() calls acf.serialize() → setAttributes({ data })
});

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect acf-pro-blocks.js, especially BlockForm.componentDidAppend() and its change/key-up handling. Reproduce the nested repeater WYSIWYG case in the Gutenberg editor, then verify that content persists when saving in Edit mode without switching to Preview.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.